我想从http://www.youtube-mp3.org/下载几首歌。我使用的是urllib2和BeautifulSoup。Python数据抓取
问题是,当我urllib2打开与我的视频ID插入的网站,http://www.youtube-mp3.org/?c#v=lV7r8PiuecQ,我得到的网站,但他们很棘手,并加载后的初始页面加载一些js ajax东西的信息。所以当我试图抓取下载链接的URL时,从字面上看不在页面上,因为它没有被加载。
任何人都知道我可能会触发这个js加载器在我的Python脚本,或者什么?
以下是我想要加载的内容之前的相关空html。
<div id="link_box" style="display:none">
<div id="link_box_title" style="font-weight:bold; text-decoration:underline">
</div>
<div class="row">
<div id="link_box_bb_code_title" style="font-weight:bold">
</div>
<input type="text" id="BBCodeLink" onclick="sAll(this)" />
</div>
<div class="row">
<div id="link_box_html_code_title" style="font-weight:bold">
</div>
<input type="text" id="HTMLLink" onclick="sAll(this)" />
</div>
<div class="row">
<div id="link_box_direct_code_title" style="font-weight:bold">
</div>
<input type="text" id="DirectLink" onclick="sAll(this)" />
</div>
</div>
<div id="v-ads">
</div>
<div id="dl_link">
</div>
<div id="progress">
</div>
<div id="loader">
<img src="ajax-loader-b.gif" alt="loading.." width="16" height="11" />
</div>
</div>
<div class="clear">
</div>
</div>
看起来我们需要http://youtube-mp3-scraper.org/:一个页面,YouTube的擦伤,MP3,这反过来又刮的YouTube;) – phihag
嗯,因为我在Mac上,也许我可以使用Automator来浏览youtube-mp3上的URL列表,并让它们逐一下载到实际的浏览器中。我宁愿留在Python中。 – Oliver
美丽的肥皂是处理键盘细菌的最佳蟒蛇库。 – Profane