日期: 2023-01-19 21:30:02
腾讯视频貌似把额外签到的服务下线了。。。手动进去都没服务了。。
更新下代码。把额外签到的部分去了。。
更新代码(2021.9.10):
1.删除额外签到部分(包括额外签到的7天抽奖)代码
PS:其实就是删了下之前【2.2版】代码中 【87-111】 行。。
最后吐槽下。话费券是真的难抢。。我都放弃了。。
# -*- coding: utf8 -*-
import requests
import re
import time
from urllib.parse import quote
#tx_getVsToken:2019.12.1
def jiemi(str1):
i=5381
e=0
n=len(str1)
while e < n :
i = i + (i<<5) + ord(str1[e])
e=e+1
#print(i)
#print(i)
res = 2147483647 & i
#print(res)
return str(res);
#更新cookie
def renew_cookie(cookie_list):
#获取刷新cookie的地址,自动跳过更新失败的cookie
res = requests.get('https://vm.gtimg.cn/tencentvideo_v1/script/txv.core.js?v=20191112').text
url1 = re.search(r'authRefresh:o(.*?)",', res).group(1)
auth_url = 'https://access.video.qq.com'+url1[2:]
new_cookie_list = []
#循环更新cookie
for cookie1 in cookie_list:
try:
s = requests.session()
headers={'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.204 Safari/537.36','referer':'https://v.qq.com/','Cookie': cookie1}
this_time = int(round(time.time() * 1000))
cookies_arr = cookie1.split('; ')
for cookie2 in cookies_arr:
c1 = cookie2.split('=')
if c1[0] =='vqq_vusession': vqq_vusession = c1[1]
#print('vqq_vusession:'+vqq_vusession )
vqq_vusession1 =jiemi(vqq_vusession)
#print('vqq_vusession加密后:'+vqq_vusession1 )
url0 = auth_url + '&type=qq&g_tk=&g_vstk='+vqq_vusession1+'&g_actk=&_=' + str(this_time)
#print(url0)
res =s.get(url0,headers=headers).text
#print('访问结果1:'+res)
new_vus = re.search(r'vusession":"(.*?)","', res).group(1)
cookie2 = cookie1.replace(vqq_vusession,new_vus)
new_cookie_list.append(cookie2)
except Exception:
print('cookie更新失败【'+vqq_vuserid+'】,跳过。')
continue
return new_cookie_list
def start():
try:
s = requests.session()
###################需要修改的部分。
cookie1_list = ['。。。这里改成自己的COOKIE。。。']
serverj_url = 'https://sc.ftqq.com/SCU34934T12d12b0。。这里写自己的SERVER酱地址。07.send?text='
#################需要修改的部分结束。下面的不要动
this_time = int(round(time.time() * 1000))
login_url = 'https://vip.video.qq.com/fcgi-bin/comm_cgi?name=hierarchical_task_system&cmd=2&_=' + str(this_time)
new_cookie_list = renew_cookie(cookie1_list)
cookie2 = new_cookie_list[0]
headers2={
'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.204 Safari/537.36',
'referer':'https://v.qq.com/',
'Cookie': cookie2
}
#签到
res2 =s.get(login_url,headers=headers2).text
print('签到结果:'+res2)
except Exception as e:
print("地址访问失败,通知SERVER酱!")
#print(e)
requests.get(serverj_url + quote('腾讯视频自动签到失败~'+time.strftime('%Y.%m.%d',time.localtime(time.time()))) +'&desp='+quote('异常代码: '+str(e)))
def main_handler(event, context):
return start()
if __name__ == '__main__':
start()复制代码