python版本:3.6
代码如下
import json
from multiprocessing.pool import Pool
from requests.exceptions import RequestException
import re
import urllib.request
# 获取页面
def get_one_page(url):
try:
req = urllib.request.Request(url)
req.add_header('User-Agent',
'Mozilla/4.0(compatible;MSIE7.0;WindowsNT5.1;Trident/4.0;SE2.XMetaSr1.0;SE2.XMetaSr1