抓取猫眼部分信息
import requests import re import json from multiprocessing import Pool def get_one_page(url): header = { 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36', } res = requests.get(url,headers=header) if res.status_code == 200: return res.text else: return None def parse_html(html): html.replace('\n','') pattern = ('<i class="board-index.*?">(. ?)</i>. ?<img data-src="(. ?)". ?</a>. ?<a href. ?>(. ?)</a>. ?<p class="star"(. ?)</p>. ?releasetime">(. ?)</p>. ?integer">(. ?)</i>. ?fraction">(.*?)</i>') items = re.findall