下载网站中的所有文件。

11

3
我建议编写一些代码来实现这个。 - Ofer Sadan
2个回答

16

您可以像这样下载文件

import urllib2
response = urllib2.urlopen('http://www.example.com/file_to_download')
html = response.read()

获取页面中的所有链接

from bs4 import BeautifulSoup

import requests
r  = requests.get("http://site-to.crawl")
data = r.text
soup = BeautifulSoup(data)

for link in soup.find_all('a'):
    print(link.get('href'))

0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接