爬取baidu的人物名稱
阿新 • • 發佈:2018-11-16
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Created on 2018-11-15 15:24:12
# Project: dcsconvert
import json
import requests
from bs4 import BeautifulSoup
fp = open("./mingxing.txt", 'a')
for line in range(1,10000):
tmpnum =line*100 + 1
url ="https://sp0.baidu.com/8aQDcjqpAAV3otqbppnN2DJv/api.php?resource_id=28266&from_mid=1&&format=json&ie=utf-8&oe=utf-8&query=%E6%98%8E%E6%98%9F&sort_key=&sort_type=1&stat0=&stat1=&stat2=&stat3=&pn="+str(tmpnum)+"&rn=100&cb=jQuery110208427746793656827_1542333834490&_=1542333834575"
print(url)
r = requests.get(url)
r.encoding = 'utf-8'
fp.write(r.text)
fp.flush()
fp.close()