无聊刷日剧,看到签到断了好久,简单写了个脚本,通过模拟抓包的方式实现

1、先登录到字幕组网站获取token

2、用获取到的token登录到人人活动页面获取cookie

3、用获取到的cookie进行签到

import requests
import json
import time
def main():
 # 登录,获取用户信息
 info = json.loads(get_token())
 uid,token = info['data']['uid'],info['data']['token']
 # 登录到活动中心,获取cookie
 cookies = get_huodong(uid,token)
 # 签到
 while True:
 qiandao(cookies)
 time.sleep(10800)
def qiandao(cookies):
 headers["Cookie"] = 'PHPSESSID={}'.format(cookies)
 info_url = "http://h5.rrhuodong.com/index.php"
 info = json.loads(get(info_url).text)['data']
 print("称昵:{}\n等级:{}\n人人钻:{}\n".format(info['nickname'],info['main_group_name'],info['point']))
 qiandao_login_url = "http://h5.rrhuodong.com/index.php"
 print("签到信息:{}".format(json.loads(get(qiandao_login_url).text)['info']))
def get_huodong(uid,token):
 huodong_login_url = "http://h5.rrhuodong.com/index.php".format(uid,token)
 return requests.utils.dict_from_cookiejar(get(huodong_login_url).cookies)['PHPSESSID']
def get_token():
 token_login_url = "http://a.zmzapi.com/index.php".format(accesskey,username,passwd)
 return get(token_login_url).text
def get(url):
 content = requests.get(url.format(username,passwd), headers=headers, verify=False, allow_redirects=False)
 return content
if __name__ == '__main__':
 # 浏览器头部
 headers = {
 "User-Agent":"Mozilla/5.0 (Linux; U; Android 9; zh-cn; MI 6 Build/9.0) AppleWebKit/533.1 (KHTML, like Gecko) Version/5.0 Mobile Safari/533.1"
 }
 # 账号、密码、accesskey需要自己抓包
 username = '账号'
 passwd = '密码'
 accesskey="xxx"
 main()

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。

华山资源网 Design By www.eoogi.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
华山资源网 Design By www.eoogi.com