从网站(livebox)提取数据

时间:2014-11-24 14:41:50

标签: javascript jquery html mirc

我使用页面源但在页面源中尝试了这个。我想要的div标签不存在。

<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>

虽然通过chrom中的开发人员工具能够找到我需要的div和(在我在调试器中暂停后)然后我可以找到我需要的文本。

<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>

现在理想情况下,我希望文本像&#34; xxxx攻击xxxx&#34;,&#34; xxxxx住院xxxxxx&#34;如果可能,将被拉入文本文件。 附:气泡只持续几秒钟,然后它们消失并出现更多。所以我们都喜欢这些

1 个答案:

答案 0 :(得分:1)

看起来您正试图为Torn自动执行某些操作?

最好和最简单的方法是使用Javascript(可能与jQuery结合)创建一些不错的用户脚本并将其注入页面。这可以通过Firefox Greasemonkey和Chrome Tampermonkey等工具完成。

对于“如何”获取它,查询计时器中的路径。

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

正确的查询是什么;只有一种方法可以找到答案。