forked from raindrop-hb/tencent-video
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.py
169 lines (158 loc) · 7.68 KB
/
index.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
#!/usr/bin/python3.10
# -*- coding: utf-8 -*-
# Copyright (C) 2023 , Inc. All Rights Reserved
# @Time : 2023/4/18 0:51
# @Author : raindrop
# @Email : [email protected]
# @File : index.py
import requests
import json
import time
import re
import push
import os
'''
可直接部署在华为云函数流
函数执行入口填:index.main_handler
触发器用cron表达式:0 30 23 * * ?
每天23:30执行
设置项
'''
'''腾讯视频签到'''
def ten_video(tag,qimei36,appid,openid,access_token,vuserid,login,ip):
#cookie='vdevice_qimei36='+qimei36+';vqq_appid='+appid+';vqq_openid='+openid+';vqq_access_token='+access_token+';main_login='+login
cookie = 'vdevice_qimei36='+qimei36+';vqq_appid=' + appid + ';vqq_openid=' + openid + ';vqq_access_token=' + access_token + ';main_login=' + login + ';vqq_vuserid=' + vuserid + ';ip=' + ip
log=''
time_1 = int(time.time())
time_2 = time.localtime(time_1)
now = time.strftime("%Y-%m-%d %H:%M:%S", time_2)
log = "腾讯视频会员签到执行任务\n--------------raindrop--------------\n" + now + '\ntag:' + tag
#积分查询
url_3 = 'https://vip.video.qq.com/fcgi-bin/comm_cgi?name=spp_vscore_user_mashup&cmd=&otype=xjson&type=1'
headers_3 = {
'user-agent': 'Mozilla/5.0 (Linux; Android 11; M2104K10AC Build/RP1A.200720.011; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/89.0.4389.72 MQQBrowser/6.2 TBS/046237 Mobile Safari/537.36 QQLiveBrowser/8.7.85.27058',
'Content-Type': 'application/json',
'cookie': cookie
}
response_3 = requests.get(url_3, headers=headers_3)
try:
res_3 = json.loads(response_3.text)
log = log + "\n会员等级:" + str(res_3['lscore_info']['level']) + "\n积分:" + str(
res_3['cscore_info']['vip_score_total']) + "\nV力值:" + str(res_3['lscore_info']['score'])
except:
try:
res_3 = json.loads(response_3.text)
log = log + "\n腾讯视频领获取积分异常,返回内容:\n" + str(res_3)
print(res_3)
except:
log = log + "\n腾讯视频获取积分异常,无法返回内容"
url_3 = 'https://vip.video.qq.com/rpc/trpc.query_vipinfo.vipinfo.QueryVipInfo/GetVipUserInfoH5'
headers_3 = {
'user-agent': 'Mozilla/5.0 (Linux; Android 11; M2104K10AC Build/RP1A.200720.011; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/89.0.4389.72 MQQBrowser/6.2 TBS/046237 Mobile Safari/537.36 QQLiveBrowser/8.7.85.27058',
'Content-Type': 'text/plain;charset=UTF-8',
'cookie': cookie
}
data = '{"geticon":1,"viptype":"svip|nfl","platform":8}'
response_3 = requests.post(url_3, data=data, headers=headers_3)
try:
res_3 = json.loads(response_3.text)
log = log + "\n开始时间:" + str(res_3['beginTime']) + "\n到期时间:" + str(
res_3['endTime'])
if res_3['endmsg'] != '':
log = log + '\nendmsg:' + res_3['endmsg']
print(log)
except:
try:
res_3 = json.loads(response_3.text)
log = log + "\n腾讯视频领获取积分异常,返回内容:\n" + str(res_3)
print(res_3)
except:
log = log + "\n腾讯视频获取积分异常,无法返回内容"
# 签到
url_1 = 'https://vip.video.qq.com/rpc/trpc.new_task_system.task_system.TaskSystem/CheckIn?rpc_data=%7B%7D'
headers_1 = {
'user-agent': 'Mozilla/5.0 (Linux; Android 11; M2104K10AC Build/RP1A.200720.011; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/89.0.4389.72 MQQBrowser/6.2 TBS/046237 Mobile Safari/537.36 QQLiveBrowser/8.7.85.27058',
'Content-Type': 'application/json',
'referer': 'https://film.video.qq.com/x/vip-center/?entry=common&hidetitlebar=1&aid=V0%24%241%3A0%242%3A8%243%3A8.7.85.27058%244%3A3%245%3A%246%3A%247%3A%248%3A4%249%3A%2410%3A&isDarkMode=0',
'cookie': cookie
}
response_1 = requests.get(url_1, headers=headers_1)
try:
res_1 = json.loads(response_1.text)
log = log + "\n签到获得v力值:" + str(res_1['check_in_score'])
print(res_1)
except:
try:
res_1 = json.loads(response_1.text)
log = log + "\n腾讯视频签到异常,返回内容:\n" + str(res_1)
print(res_1)
except:
log = log + "\n腾讯视频签到异常,无法返回内容"
# 观看
url_2 = 'https://vip.video.qq.com/rpc/trpc.new_task_system.task_system.TaskSystem/ProvideAward?rpc_data=%7B%22task_id%22:1%7D'
headers_2 = {
'user-agent': 'Mozilla/5.0 (Linux; Android 11; M2104K10AC Build/RP1A.200720.011; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/89.0.4389.72 MQQBrowser/6.2 TBS/046237 Mobile Safari/537.36 QQLiveBrowser/8.7.85.27058',
'Content-Type': 'application/json',
'referer': 'https://film.video.qq.com/x/vip-center/?entry=common&hidetitlebar=1&aid=V0%24%241%3A0%242%3A8%243%3A8.7.85.27058%244%3A3%245%3A%246%3A%247%3A%248%3A4%249%3A%2410%3A&isDarkMode=0',
'cookie': cookie
}
response_2 = requests.get(url_2, headers=headers_2)
try:
res_2 = json.loads(response_2.text)
log = log + "\n观看获得v力值:" + str(res_2['provide_value'])
print(res_2)
except:
try:
res_2 = json.loads(response_2.text)
log = log + "\n腾讯视频领取观看v力值异常,返回内容:\n" + str(res_2)
print(res_2)
except:
log = log + "\n腾讯视频领取观看v力值异常,无法返回内容"
#任务状态
url='https://vip.video.qq.com/rpc/trpc.new_task_system.task_system.TaskSystem/ReadTaskList?rpc_data=%7B%22business_id%22:%221%22,%22platform%22:3%7D'
headers={'user-agent':'Mozilla/5.0 (Linux; Android 11; M2104K10AC Build/RP1A.200720.011; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/89.0.4389.72 MQQBrowser/6.2 TBS/046237 Mobile Safari/537.36 QQLiveBrowser/8.7.85.27058',
'Content-Type':'application/json',
'referer':'https://film.video.qq.com/x/vip-center/?entry=common&hidetitlebar=1&aid=V0%24%241%3A0%242%3A8%243%3A8.7.85.27058%244%3A3%245%3A%246%3A%247%3A%248%3A4%249%3A%2410%3A&isDarkMode=0',
'cookie':cookie
}
response = requests.get(url,headers=headers)
try:
res = json.loads(response.text)
lis=res["task_list"]
log = log + '\n---------v力值任务状态----------'
for i in lis:
if i["task_button_desc"]=='已完成':
log=log+'\n标题:'+i["task_maintitle"]+'\n状态:'+i["task_subtitle"]
except:
log = log + "获取状态异常,可能是cookie失效"
print(push.main(log))
def config():
path = os.getcwd()
if path == '/opt/function':
path = 'code/'
else:
path = ''
with open(path + 'config.json', encoding='utf-8') as f:
account = f.read()
a=account.count('/*')
for i in range(a):
x=account.find('/*')
y=account.find('*/')+2
account=account[:x]+account[y:]
account=json.loads(account)
return account
def main():
configs = config()
a=configs["users"]
for user in a:
if eval(user['enable']):
if 'ip' in user:
ipp=user['ip']
else:
ipp='39.144.36.110'
print(ipp)
ten_video(user['tag'],user['vdevice_qimei36'],user['vqq_appid'],user['vqq_openid'],user['vqq_access_token'],user['vqq_vuserid'],user['main_login'],ipp)
def main_handler(event, context):
return main()
if __name__ == '__main__':
main()