如何扫描网页并获取图像和youtube嵌入?

rks*_*rst 2 python screen-scraping web-applications

我建立一个web应用程序,我需要在一个给定的URL得到所有的图像和嵌入任何Flash视频(例如YouTube)的.我正在使用Python.

我GOOGLE了,但还没有找到关于这个(可能是因为我不知道这是什么所谓的搜索),没有任何人有任何这方面的经验,知道如何可以做到任何良好的信息?

如果有可用的话,我很乐意看到一些代码示例.

谢谢!

Ned*_*der 7

BeautifulSoup是一个很棒的屏幕抓图库.使用urllib2获取页面,使用BeautifulSoup将其解析.这是他们的文档中的代码示例:

import urllib2
from BeautifulSoup import BeautifulSoup

page = urllib2.urlopen("http://www.icc-ccs.org/prc/piracyreport.php")
soup = BeautifulSoup(page)
for incident in soup('td', width="90%"):
    where, linebreak, what = incident.contents[:3]
    print where.strip()
    print what.strip()
    print
Run Code Online (Sandbox Code Playgroud)