淘宝直播爬虫
直接上代码:
# !/usr/bin/python
# -*- coding: UTF-8 -*-
import requests
appKey = '12574478'
def get_params(api, v, data, t, sign=''):
return {
'type': 'originaljson',
'jsv': '2.4.0',
'appKey': appKey,
't': t,
'AntiCreep': 'true',
'api': api,
'v': v,
'data': data,
'sign': sign,
}
def get_headers(cookie=''):
return {
'accept-encoding': 'gzip, deflate, br',
'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8,zh-TW;q=0.7',
'user-agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1',
'accept': '*/*