Created
November 6, 2021 13:39
-
-
Save ruter/e52c730f5c49330f10f191e51139e8fb to your computer and use it in GitHub Desktop.
奥乐齐每日签到脚本
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -* | |
# 奥乐齐每日签到 | |
import os, re, sys | |
import json | |
try: | |
import requests | |
except Exception as e: | |
print(e, "\n缺少requests 模块,请执行命令安装:python3 -m pip install requests") | |
exit(3) | |
requests.packages.urllib3.disable_warnings() | |
def start(): | |
""" | |
抓包并替换以下请求头 | |
Authorization | |
cookie | |
User-Agent | |
""" | |
scriptName='### 奥乐齐 - 每日签到 ###' | |
print(scriptName) | |
api_url = 'https://m.aldi.com.cn/ouser-center/api/user/info/userSign.do' | |
headers = { | |
'cookie': '', | |
'X-Requested-With': 'XMLHttpRequest', | |
'content-type': 'application/x-www-form-urlencoded;text/html;charset=utf-8', | |
'Authorization': '', | |
'Accept': 'application/json,text/plain,*/*', | |
'Accept-Encoding': 'gzip,compress,br,deflate', | |
'User-Agent': '', | |
'Referer': 'https://servicewechat.com/wxcc73ef38a41c951a/156/page-frame.html', | |
} | |
resp = requests.post(api_url, headers=headers, data={}) | |
res = resp.json().get('data', {}) | |
if res: | |
msg = f'{"签到成功!" if res.get("currentDaySigned") else "签到失败!"}\n\n已连续签到 {res.get("durationDay", 0)} 天。' | |
else: | |
msg = '签到失败!' | |
print(msg) | |
cur_path = os.path.abspath(os.path.dirname(__file__)) | |
sys.path.append(cur_path) | |
if os.path.exists(cur_path + "/sendNotify.py"): | |
try: | |
from sendNotify import send | |
send(scriptName, msg) | |
except: | |
pass | |
if __name__ == '__main__': | |
start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment