#-*- coding:utf-8 -*- import requests import json import pandas as pd headers = { 'User-Agent':'Mozilla/5.0 (Windows NT 6.1; W…) Gecko/20100101 Firefox/61.0' } res = requests.get('https://feed.sina.com.cn/api/roll/get?pageid=121&lid=1356&num=20&versionNumber=1.2.4&page=1&encode=utf-8&callback=feedCardJsonpCallback&_=1554687410372') res.encoding = 'utf-8' a = str(res.text) res1 = a.split("try{feedCardJsonpCallback(")[1].split(");}catch(e){};")[0] b = json.loads(res1) news = {} w = b['result']['data'] for i in w: print(i['url'] + " " + "--- " + i['title'])
爬虫之爬取新浪新闻
最新推荐文章于 2020-10-19 09:28:15 发布