![](https://img-blog.csdnimg.cn/2019091813595558.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
python爬虫
python爬虫技巧
liuwangleoooO
失败了 别给自己找理由 就是菜而已!
展开
-
爬虫—美食天下各类菜谱的菜单信息
效果图import csvimport osimport randomimport requestsfrom lxml import etree# 请求头head = ['Mozilla/5.0', 'Chrome/78.0.3904.97', 'Safari/537.36']headers = { 'user-agent': head[random.randint(0, 2)]}def makedir(path): path = path.strip()原创 2020-12-11 16:20:22 · 2302 阅读 · 8 评论 -
爬虫—dy直播各个类别下直播数据
附代码直播首页数据import requestsimport flaskfrom bs4 import BeautifulSoupfrom lxml import etreedef getInfoUtils(info): if info: return info[0] else: ''def getHtml(url): response = requests.get(url) try: if respon原创 2020-12-06 14:00:40 · 21294 阅读 · 0 评论 -
爬虫—图片下载
某网站的美铝图片下载代码附上import randomimport requestsfrom lxml import etreedef getHtml(url): # proxies = {'http': '123.160.68.82:9999'} try: head = ['Mozilla/5.0', 'Chrome/78.0.3904.97', 'Safari/537.36'] headers = { 'user-原创 2020-12-06 14:54:29 · 3114 阅读 · 0 评论 -
爬虫—豆瓣图书标签下的书籍信息
注意:爬虫要适量,代码需谨慎豆瓣图书标签下的书籍信息直接奉上效果内容为了减少服务器的压力,我只获取了每个标签下书籍的第一页数据,一定要注意!步骤就不详细写了,全在代码里边import randomimport requestsfrom lxml import etreefrom multiprocessing import Pooldef getHtml(url): try: head = ['Mozilla/5.0', 'Chrome/78.0.390原创 2020-12-06 12:24:14 · 4473 阅读 · 0 评论