python爬虫实例
****# 虽然没什么用,学习阶段,练手。 一、 爬取表情包 1、爬取斗图啦: import requests from bs4 import BeautifulSoup import threading glock = threading.Lock() headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36', 'Referer': 'https://hacpai.com/login'} class get_doutu(): def all_htmls(self): htmls = [] for i in range(1,10): url = "https://www.doutula.com/photo/list/?page=%s"%i res = requests.get(url,headers=headers) htmls.append(res.text) ret....