import requests
import re,json,pymysql
ss=0
headers = {
“User-Agent”: ‘Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36’,
}
for num in range(0,165,15):
print(ss)
url=‘http://www.tmtpost.com/ajax/common/get?url=%2Fv1%2Fposts%2Flist%2Fcategory%2F3189960&data=limit%3D15%26offset%3D{}%26fields%3Dthumb_image%3Bsummary%3Bnumber_of_comments%3Btags%3Bauthors%26thumb_image_size%3D[“200_150”]’.format(num)
response=requests.get(url,headers=headers)
text1 = json.loads(response.text)[“data”]
nn=0
for one in text1:
try:
title=str(one[“title”])
except:
title=“空”
print(title)
try:
creat_time=str(one[“time_created”])
except:
creat_time=“空”
print(creat_time)
try:
Central_idea=str(one[‘summary’])
except:
Central_idea=“空”
print(Central_idea)
try:
label=[]
for label_one in one[“tags”]:
label.append(label_one[“tag”])
except:
label=“空”
print(label)
try:
source=str(one[“authors”][0][“username”])
except:
source=“空”
author_kind=“空”
try:
info_url=“http://www.tmtpost.com/{}.html".format(one["post_guid”])
except:
info_url=“空”
try:
response_info = requests.get(info_url, headers=headers)
text_info=response_info.text
#print(text_info)
article=re.findall(’’’