zl程序教程

您现在的位置是:首页 >  后端

当前栏目

Python批量下载豆瓣妹子的图片详解编程语言

Python批量下载编程语言 详解 图片 豆瓣 妹子
2023-06-13 09:20:23 时间
def crawl(url): headers = {User-Agent:Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6} req = urllib.request.Request(url, headers=headers) page = urllib.request.urlopen(req, timeout=20) contents = page.read() soup = BeautifulSoup(contents) my_girl = soup.find_all(img) for girl in my_girl: link = girl.get(src) print(link) content2 = urllib.request.urlopen(link).read() with open(uD:/doubanmeizi+/+link[-11:],wb) as code: code.write(content2) page_start = 0 page_stop = 10 for page in range(page_start, page_stop): page += 1 url = http://www.dbmeinv.com/?pager_offset=%s % page crawl(url) print("哈哈,妹子图片下载完毕啦!")

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/8106.html

cpythonwindows