MCPcopy Create free account
hub / github.com/LumingMelody/JS_reverse / get_headers

Function get_headers

gdtv.py:18–34  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

16
17
18def get_headers(url):
19 headers = {
20 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36',
21 'origin': 'https://www.gdtv.cn',
22 'referer': 'https://www.gdtv.cn/',
23 'x-itouchtv-ca-key': '89541443007807288657755311869534',
24 'x-itouchtv-client': 'WEB_PC',
25 }
26 base_str = 'ABCDEFGHIGKLMNOPQRSTUVWXYZabcdefghigklmnopqrstuvwxyz0123456789'
27 device_id = 'WEB_1068fae0-504e-11ed-82cf-' + ''.join([random.choice(base_str) for i in range(12)])
28 headers.update({'x-itouchtv-device-id': device_id})
29 d = str(int(time.time() * 1000))
30 v = 'GET\n' + url + '\n' + d + '\n'
31 k = 'dfkcY1c3sfuw0Cii9DWjOUO3iQy2hqlDxyvDXd1oVMxwYAJSgeB6phO8eW1dfuwX'.encode('utf-8')
32 signature = str(base64.b64encode(hmac.new(k, v.encode('utf-8'), digestmod=sha256).digest()), 'utf-8')
33 headers.update({'x-itouchtv-ca-signature': signature, 'x-itouchtv-ca-timestamp': d})
34 return headers
35
36
37def get_data(url):

Callers 1

get_dataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected