【发布时间】:2014-01-15 04:25:36
【问题描述】:
我想从在线聊天机器人获得答案。 http://talkingbox.dyndns.org:49495/braintalk? (? 属于链接)
要发送问题,您只需发送一个简单的请求:
http://talkingbox.dyndns.org:49495/in?id=3B9054BC032E53EF691A9A1803040F1C&msg=[Here the question]
来源如下:
<frameset cols="*,185" frameborder="no" border="0" framespacing="0">
<frameset rows="100,*,82" frameborder="no" border="0" framespacing="0">
<frame src="http://thebot.de/bt_banner.html" marginwidth="0" name="frtop" scrolling="no" marginheight="0" frameborder="no">
<frame src="out?id=3B9054BC032E53EF691A9A1803040F1C" name="frout" marginwidth="0" marginheight="0">
<frameset rows="100%,*" border="0" framespacing="0" frameborder="no">
<frame src="bt_in?id=3B9054BC032E53EF691A9A1803040F1C" name="frin" scrolling="no" marginwidth="0" marginheight="0" noresize>
<frame src="" name="frempty" marginwidth="0" marginheight="0" scrolling="auto" frameborder="no" >
</frameset>
</frameset>
<frameset frameborder="no" border="0" framespacing="0" rows="82,*">
<frame src="stats?" name="fr1" scrolling="no" marginwidth="0" marginheight="0" frameborder="no">
<frame src="http://thebot.de/bt_rechts.html" name="fr2" scrolling="auto" marginwidth="0" marginheight="0" frameborder="no" >
</frameset>
</frameset>
我使用“mechanize”和 beautifulsoup 进行网页抓取,但我认为 mechanize 不支持动态网页。
在这种情况下我怎样才能得到答案?
我也在寻找一种适用于 Windows 和 Linux 的解决方案。
【问题讨论】:
-
你可以试试selenuim,它擅长浏览器自动化以及它对phantomjs的绑定(它为headless Webkit提供了JS API,Webkit是一个渲染引擎)。 realpython.com/blog/python/…
-
什么是动态网页?这些框架只知道http请求,而且你分享的链接是不可访问的
-
@Guy 我认为“user317”是指通过 XHR 请求获取的内容,但我同意更多细节会有所帮助。
-
对不起,链接是talkingbox.dyndns.org:49495/braintalk? (最后的 ? 被stackoverflow切断)。框架的 Url 是 talkingbox.dyndns.org:49495/… 问题是无法像这样访问框架。
-
感谢您的帮助。我可能必须澄清我在获得答案而不发送它们时遇到问题,因为嵌套框架内的答案是使用 JavaScript 动态生成的。本帧:talkingbox.dyndns.org:49495/…
标签: python beautifulsoup screen-scraping mechanize frames