# @Date: 2020-03-31 14:13:35 # @Last Modified by: clela # @Last Modified time: 2020-04-01 23:45:58 import requests, json url = 'https://c.m.163.com/ug/api/wuhan/app/data/list-total?t=317150961437' headers = { 'origin': 'https://wp.m.163.com', 'referer': 'https://wp.m.163.com/163/page/news/virus_report/index.html', 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36', html = requests.get(url, headers = headers).text # print(html.text) json_text = json.loads(html)["data"]['chinaTotal']['total'] # print(json_text) for key, value in json_text.items(): print(key, value)