一个简单的爬虫源码
一个不正经的视频教学
import requests
import re
import time
headers={'user-agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36'}
response=requests.get("https://mm.enterdesk.com/bizhi/62854-340754.html",headers=headers)
html=response.text
urls&#61;re.findall(r&#39; class&#61;"pics_pics "\src&#61;".*?"\href&#61;".*?"><img\src&#61;"(.*?)"\title&#61;"双马尾美女青春迷人写真"/></a></div>\<div class&#61;".*?"><a\&#39;, html)
print(urls)
for url in urls:time.sleep(30) file_name &#61; url.split(&#39;/&#39;)[-1] response &#61; requests.get(url, headers&#61;headers)with open(file_name, &#39;wb&#39;) as f: f.write(response.content)