Pulling data from a website (livebox)

219 views Asked by At

I have tried this using the page sources but in the page source. The div tag i want is absent.

<div class="city-banner autumn livebox globalEvents">
<div class="cloud-3 content">
    <div class="cloud-2">
        <div class="cloud-1">
            <div class="plane-left">
                <div class="plane-right">
                    <div class="city">
                        <div class="ship left-course">
                            <div class="yacht">
                                <div class="precipitation">
                                    <div class="lightning-1"></div>
                                    <div class="lightning-2"></div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

while going through the Developer tools in chrom is was able to find the div i needed and (after i paused in debugger) then i could find the text i needed aswell.

<div class="bubble" style="margin-left: 537px; margin-top: 63px;"><div class="bubble-inner"><div class="bubble-text"><a href="/profiles.php?XID=1869105" target="_blank">barradell12</a> attacked <a href="/profiles.php?XID=593432" target="_blank">ChaosViper</a></div></div><div class="bubble-tail"></div></div><div class="bubble" style="margin-left: 181px; margin-top: 113px;"><div class="bubble-inner"><div class="bubble-text"><a href="/profiles.php?XID=492053" target="_blank">Nahid7</a> attacked <a href="/profiles.php?XID=1814701" target="_blank">FHC</a></div></div><div class="bubble-tail"></div></div><div class="bubble" style="margin-left: 1183px; margin-top: 7px;"><div class="bubble-inner"><div class="bubble-text">lol</div></div><div class="bubble-tail"></div></div><div class="bubble" style="margin-left: 615px; margin-top: 8px; opacity: 0.684062276342339;"><div class="bubble-inner"><div class="bubble-text"><a href="/profiles.php?XID=1869105" target="_blank">barradell12</a> mugged <a href="/profiles.php?XID=593432" target="_blank">ChaosViper</a></div></div><div class="bubble-tail"></div></div><div class="bubble" style="margin-left: 283px; margin-top: 8px; opacity: 0.561107899969945;"><div class="bubble-inner"><div class="bubble-text">Someone mugged <a href="/profiles.php?XID=1774422" target="_blank">cheesejointsuk</a></div></div><div class="bubble-tail"></div></div><div class="bubble" style="display:none;"><div class="bubble-inner"><div class="bubble-text"><a href="/profiles.php?XID=732076" target="_blank">rexxcii</a> attacked <a href="/profiles.php?XID=1017193" target="_blank">black15</a></div></div><div class="bubble-tail"></div></div><div class="bubble" style="display:none;"><div class="bubble-inner"><div class="bubble-text">Someone hospitalized <a href="/profiles.php?XID=689007" target="_blank">TheWalrus</a></div></div><div class="bubble-tail"></div></div></div>
</div>

Now ideally i would like the text like "xxxx attacked xxxx", "xxxxx hospitalized xxxxxx" to be pulled into a text file if possible. P.s. the bubbles only last for a few seconds then they dissapear and more appear. So id like them all

1

There are 1 answers

4
Viezevingertjes On BEST ANSWER

Looks like you're trying to automate something for Torn?

The best and easiest way is to create some nice userscript with Javascript (maybe in combination with jQuery) and inject it in the page. This can be done with tools like Greasemonkey for firefox and Tampermonkey for chrome.

For the "how" to get it, query the path in a timer.

setTimeout(function(){
    //Scan for popup
}, 1000);

On what the correct queries are; only one way to find out.