用curl.trillworks.com神器爬虫,结果数据是null是为什么?

python菜鸟,在用python爬取东方财富网股票数据的时候,用了https://curl.trillworks.com/的ctrl+V的代码,但是爬网页数据时"data"显示null,没有把字典数据爬下来,是为什么?是被反爬了吗?求解答

代码:

import requests

cookies = {
    'qgqp_b_id': '4258d3f58b377d74ef4ada0d4c25613a',
    'st_si': '50659914653304',
    'cowCookie': 'true',
    'em-quote-version': 'topspeed',
    'cowminicookie': 'true',
    'HAList': 'a-sh-600000-^%^u6D66^%^u53D1^%^u94F6^%^u884C^%^2Ca-sz-300059-^%^u4E1C^%^u65B9^%^u8D22^%^u5BCC',
    'em_hq_fls': 'old',
    'intellpositionL': '578px',
    'waptgshowtime': '2020125',
    'emshistory': '^%^5B^%^22600001^%^22^%^2C^%^22600000^%^22^%^2C^%^22^%^E6^%^B5^%^A6^%^E5^%^8F^%^91^%^E9^%^93^%^B6^%^E8^%^A1^%^8C^%^22^%^5D',
    'st_asi': 'delete',
    'st_pvi': '77211702794515',
    'st_sp': '2020-12-04^%^2011^%^3A16^%^3A16',
    'st_inirUrl': 'https^%^3A^%^2F^%^2Fwww.baidu.com^%^2Flink',
    'st_sn': '318',
    'st_psi': '20201205092625901-113300300815-0956012705',
    'intellpositionT': '1051.8px',
}

headers = {
    'Connection': 'keep-alive',
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36',
    'Accept': '*/*',
    'Referer': 'http://data.eastmoney.com/',
    'Accept-Language': 'zh-CN,zh;q=0.9',
}

params = (
    ('lmt', '0^'),
    ('klt', '1^'),
    ('secid', '1.600000^'),
    ('fields1', 'f1,f2,f3,f7^'),
    ('fields2', 'f51,f52,f53,f54,f55,f56,f57,f58,f59,f60,f61,f62,f63^'),
    ('ut', 'b2884a393a59ad64002292a3e90d46a5^'),
    # ('cb', 'jQuery183049251612203668804_1607131686077^'),
    ('_', '1607131686358'),
)

response = requests.get('http://push2.eastmoney.com/api/qt/stock/fflow/kline/get', headers=headers, params=params, cookies=cookies, verify=False)

print(response)
print(response.content)

结果:

这边"data":null,实际data是有字典的,该怎么办才能爬下来?

查看全部
weixin_51637262
好好学习报效自己
2020/12/05 15:01
  • python
  • 点赞
  • 收藏
  • 回答
    私信

0个回复