您的位置:首页 > 编程语言 > Python开发

Python 抓图

2016-07-13 15:00 381 查看

CMD

pip install requests

pip install beautifulsoup4

IDLE

>>> import requests
>>> url = 'https://unsplash.com'
>>> html = requests.get(url).text
>>> from bs4 import BeautifulSoup
>>> soup = BeautifulSoup(html, "html.parser")
>>> doc = soup.select('a[href^="https://unsplash.com/photos/"]')
>>> for x in doc:
print(x['href']+'/download')


链接链接下来用迅雷打开

不过迅雷生成的没有后缀名的文件

CMD

CD 到下载目录

ren * *.jpg


这个命令来重命名
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: