Skip to content

爬取腾讯安全卫士的文章

list.py

python
import requests
import json

url = "https://kf.qq.com/touch/jubaoxcx/js/gimmick_data.js"

payload={}
headers = {
  'Host': 'kf.qq.com',
  'Content-Type': 'application/json',
  'Connection': 'keep-alive',
  'Accept': '*/*',
  'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_8 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/7.0.14(0x17000e05) NetType/WIFI Language/zh_CN',
  'Accept-Language': 'zh-cn',
  'Accept-Encoding': 'gzip, deflate, br'
}

response = requests.request("GET", url, headers=headers, data=payload)

with open("a.json", "w", encoding='utf-8') as fp:
  json.dump(response.json(), fp, indent=2, ensure_ascii=False)

get single item

python
import requests
import json

url = "https://kf.qq.com/touch/jubaoxcx/js/gimmick/C662742E032653BC3412.js?_t=0.8972222840617515"

payload={}
headers = {
  'Host': 'kf.qq.com',
  'Content-Type': 'application/json',
  'Connection': 'keep-alive',
  'Accept': '*/*',
  'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_8 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/7.0.14(0x17000e05) NetType/WIFI Language/zh_CN',
  'Accept-Language': 'zh-cn',
  'Accept-Encoding': 'gzip, deflate, br',
}

response = requests.request("GET", url, headers=headers, data=payload)

with open("b.json", "w", encoding='utf-8') as fp:
  json.dump(response.json(), fp, indent=2, ensure_ascii=False)

Released under the MIT License.