-
Notifications
You must be signed in to change notification settings - Fork 134
/
xmly_10draw.py
45 lines (40 loc) · 1.96 KB
/
xmly_10draw.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/python3
# -- coding: utf-8 --
# -------------------------------
# @Author : github@wd210010 https://github.com/wd210010/just_for_happy
# @Time : 2023/2/27 13:23
# -------------------------------
# cron "6 * * *" script-path=xxx.py,tag=匹配cron用
# const $ = new Env('喜马拉雅转盘抽奖')
import requests, json, time ,os
# 写的是喜马拉雅每日十连抽 十连抽一次抓包https://m.ximalaya.com/x-web-activity/draw/activity/drawTenAction这个域名的cookie
# 青龙变量 xmly_cookie
xmly_cookie = os.getenv("xmly_cookie").split('#')
for i in range(3):
url = 'https://m.ximalaya.com/x-web-activity/draw/activity/drawTenAction'
headers = {
'Cookie': f'{xmly_cookie}',
'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 iting/9.1.3 kdtunion_iting/1.0 iting(main)/9.1.3/ios_1 ;xmly(main)/9.1.3/iOS_1',
}
data = {
'activityId': '2'
}
html = requests.post(url=url, headers=headers, data=data)
if str(json.loads(html.text)['data']['success']) == 'true':
awardslist = []
for j in range(len(json.loads(html.text)['data']['awards'])):
awards = son.loads(html.text)['data']['awards'][j]['description']
awardslist.append(awards)
print(
'抽奖成功! 获得奖品:' + '\n' + str(awardslist).replace('[', '').replace(']', '').replace(',', '\n').replace(
' ', '').replace('\'', ''))
else:
print(str(json.loads(html.text)['data']['errorMsg']))
time.sleep(5)
url2 = 'https://m.ximalaya.com/x-web-activity/draw/activity/receivingPercentAward'
html2 = requests.post(url=url2, headers=headers, data=data)
if str(json.loads(html2.text)['data']['success']) == 'true':
print('抽奖成功! ' + '获得奖品' + str(json.loads(html.text)['data']['awards']))
else:
print(str(json.loads(html2.text)['data']['errorMsg']))
time.sleep(5)