5 minutes to learn Python, do sign scripts, no longer afraid to sign it off!

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/meiguanxi7878/article/details/102691742

Brush boring drama, saw the sign off for a long time, simply write a script, implemented by way of analog capture

0, log on to the website for token subtitles group

1, with the acquired token to log in to all the activities page for cookie

2, a sign with the acquired 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?g=api/mission&m=index&a=user_info"
 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?g=api/mission&m=clock&a=store&id=2"
 print("签到信息:{}".format(json.loads(get(qiandao_login_url).text)['info']))
def get_huodong(uid,token):
 huodong_login_url = "http://h5.rrhuodong.com/index.php?g=api/mission&m=index&a=login&uid={}&token={}".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?g=api/public&m=v2&accesskey={}&client=2&a=login&account={}&password={}".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()
在学习过程中有什么不懂得可以加我的
python学习交流扣扣qun,784758214
群里有不错的学习视频教程、开发工具与电子书籍。
与你分享python企业当下人才需求及怎么从零基础学习好python,和学习什么内容

The article also think I may wish to point a praise, have any comments or opinions are welcome to comment!

Guess you like

Origin blog.csdn.net/meiguanxi7878/article/details/102691742