腾讯视频vip花了钱,还不能自动升级,要每天签到才涨V力值。升级VIP等级。。实在蛋疼。这次又是云服务器函数,搞了个脚本COOKIES方式登录。测试了40多天。还没到期,感觉自用够了。分享出来吧。。
cookies获取麻烦点。不过也就一两分钟的事,能用1个月以上就够了。
准备工具:
chrome浏览器
qq或微信登录腾讯云
腾讯视频会员一枚
第一步:获取cookies 1.浏览器打开腾讯视频官网:
https://v.qq.com/
登录VIP账号(这里我就不详写了。应该都会。我是直接手机扫码登录)
2.VIP账号登录成功后,打开另一个地址:
https://vip.video.qq.com/fcgi-bin/comm_cgi?name=hierarchical_task_system&cmd=2
(没错这个就是签到地址。APP抓出来的。)
3.在第二个地址,按下快捷键:CTRL+SHIFT+J
在>后面输入:document.cookie
回车,复制【引号里】的内容(脚本要用的cookies):
pgv_pvi=513475……..(中间打码了。。看个开头和结尾吧)…. uid=59985555 第二部:腾讯云部署脚本 用qq或者微信登录腾讯云scf(无服务器云函数)
https://console.cloud.tencent.com/scf
函数服务=》(选择区域,上海,广州,成都,香港,北京)
=》新建=》空白函数=》函数名称(随便写,比如txsp_qiandao)=》运行环境(python3.6)=》下一步
复制下面代码:
# -*- coding: utf8 -*- import requests import re import time from urllib.parse import quote def start(): try: s = requests.session() cookie1 = 'TXSP_COOKIE' 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) 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', 'Cookie': cookie1 } res =s.get(login_url,headers=headers).text print('访问结果:'+res) if 'Account Verify Error' in res: print('cookies失效,通知SERVER酱!') requests.get('https://sc.ftqq.com/SCKEY.send?text=' + quote('腾讯视频自动签到失败~'+time.strftime('%Y.%m.%d',time.localtime(time.time()))) +'&desp='+quote('cookies失效,请更新!\n')) else: print('签到完成') except Exception as e: print("地址访问失败,通知SERVER酱!") requests.get('https://sc.ftqq.com/SCKEY.send?text=' + quote('腾讯视频自动签到失败~'+time.strftime('%Y.%m.%d',time.localtime(time.time()))) +'&desp='+quote('异常代码:\n'+str(e))) def main_handler(event, context): return start() if __name__ == '__main__': start() 代码需要修改的地方3处,
TXSP_COOKIE (一处,刚才获取的cookies字符串)
https://sc.ftqq.com/SCKEY.send (两处,server酱的地址,申请地址:http://sc.ftqq.com/)
...