Giter Site home page Giter Site logo

smzdm_bot's Introduction

什么值得买每日签到脚本

更新日志

  • 2022-12-08, 签到失败,浏览器端签到需要滑动验证码认证
  • 2023-01-11, 更改User-AgentiPhone后可bypass滑块认证
  • 2023-01-14, 登录认证失败, 签到失效
  • 2023-02-18, 通过安卓端验证登录,感谢 jzksnsjswkw/smzdm-app 的思路. 旧版代码查看 old 分支
  • 2023-02-25, 新增all_rewardextra_reward两个接口,本地支持多用户运行
  • 2023-02-27, 修复本地 docker-compose 运行问题; 本地 docker-compose 支持多账号运行
  • 2023-03-01, 支持青龙面板且支持多账号
  • 2023-03-01, 仅需要ANDROID_COOKIESK两个变量,自动生成USER_AGENTTOKEN, 引入随机休眠,减小被封概率
  • 2023-03-02, 新增每日抽奖,参考 hex-ci 的思路
  • 2023-04-06, 新增企业微信BOT-WEBHOOK通知推送方式,仅需要ANDROID_COOKIE一个变量, SK改为可选变量. 如果能够通过抓包抓到,最好填上.
  • 2023-04-23,更新抽奖功能

1. 实现功能

  • 每日签到, 额外奖励,随机奖励
  • 多种运行方式: GitHub Action, 本地运行,docker, 青龙面板
  • 多种通知方式: pushplus, server酱,企业微信bot-webhook, telegram bot(支持自定义反代Telegram Bot API. 搭建教程)
  • 支持多账号(需配置config.toml)

2. 配置

支持两种读取配置的方法,从环境变量或者config.toml中读取

2.1 从环境变量中读取配置

# Cookie
ANDROID_COOKIE = ""
SK = "" # 可选,如果抓包抓到最好设置

# Notification
PUSH_PLUS_TOKEN = ""
SC_KEY = ""
WECOM_BOT_WEBHOOK = ""
TG_BOT_TOKEN = ""
TG_USER_ID = ""

# 用于自定义反代的Telegram Bot API(按需设置)
TG_BOT_API = ""

# 用于docker运行的定时设定(可选),未设定则随机定时执行
SCH_HOUR=
SCH_MINUTE=

2.2 从config.toml中读取

参考模板 app/config/config_example.toml

[user.A]
ANDROID_COOKIE = ""
SK = "" # 可选,如果抓包抓到最好设置

[user.B]
# Disable userB的签到. 不配置此参数默认启用该用户
Disable = true
ANDROID_COOKIE = ""
SK = "" # 可选,如果抓包抓到最好设置

[notify]
PUSH_PLUS_TOKEN = ""
SC_KEY = ""
WECOM_BOT_WEBHOOK = ""
TG_BOT_TOKEN = ""
TG_USER_ID = ""
TG_BOT_API = ""

3. 使用

3.1 青龙面板

ql repo https://github.com/Chasing66/smzdm_bot.git "smzdm_ql.py"

默认情况下从环境变量读取配置,仅支持单用户.

如果需要支持多用户,推荐使用config.toml, 配置参考 2.2 从config.toml中读取. 配置完成后, 拷贝config.toml到青龙容器内的/ql/data/repo/Chasing66_smzdm_bot/app/config

docker cp config.toml <你的青龙容器名称>:/ql/data/repo/Chasing66_smzdm_bot/app/config

3.2 本地直接运行

克隆本项目到本地, 按照需求配置,配置参考 2.2 从config.toml中读取

python3 -m venv .venv
source .venv/bin/activate
cd app
pip install -r requirements.txt
python main.py

3.3 本地 docker-compose 运行

配置参考2.2 从config.toml中读取

修改 docker-compose.yaml, 将app/config/config.tomlmout 到容器内/smzdm_bot/config/config.toml

version: "3.9"
services:
  smzdm_bot:
    image: enwaiax/smzdm_bot
    container_name: smzdm_bot
    restart: on-failure
    logging:
      driver: "json-file"
      options:
        max-size: "1m"
        max-file: "1"
    volumes:
      - ./app/config/config.toml:/smzdm_bot/config/config.toml

3.4 Git Action 运行

GitHub Action 禁止对于 Action 资源的滥用,请尽可能使用其他方式

GitHub Action 仅支持env配置方式, 务必自行更改为随机时间

  1. Fork此仓库项目>, 欢迎star~
  2. 修改 .github/workflows/checkin.yml里的下面部分, 取消schedule两行的注释,自行设定时间
# UTC时间,对应Beijing时间 9:30
schedule:
  - cron: "30 1 * * *"
  1. 配置参考 2.1.1 从环境变量中读取配置

4. 其它

4.1 手机抓包

抓包有一定门槛,请自行尝试! 如果实在解决不了,请我喝瓶可乐可以帮忙

抓包工具可使用 HttpCanary,教程参考HttpCanary 抓包

  1. 按照上述教程配置好 HttpCanary
  2. 开始抓包,并打开什么值得买 APP
  3. 过滤https://user-api.smzdm.com/checkinpost请求并查看
  4. 点击右上角分享,分享 cURL,复制保存该命令
  5. 将复制的 curl 命令转换为 python 格式,方法
  6. 填入转换后的Cookiessk. Cookiesheaders里,skdata里, sk是可选项

5. Stargazers over time

Stargazers over time

smzdm_bot's People

Contributors

dependabot[bot] avatar enwaiax avatar googidaddy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

smzdm_bot's Issues

签到失败

签到失败,提示登录失败,但是如果手机签到后,再执行,就成功显示金币多少啥的

github aciton怎么配置 ??

github aciton怎么配置 ??、github aciton怎么配置 ??、github aciton怎么配置 ??、github aciton怎么配置 ??、、

请问教程说的2.1.1 在哪里?

青龙容器报错Running pip as the 'root'

开始执行... 2023-05-28 09:34:27

WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
2023-05-28 09:34:28.074 | INFO | main:load_conf:37 - Please set cookies first

执行结束... 2023-05-28 09:34:28 耗时 1 秒

青龙面板运行脚本报错

什么值得买签到

开始执行... 2023-12-04 17:58:12

WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

[notice] A new release of pip is available: 23.0.1 -> 23.3.1
[notice] To update, run: pip install --upgrade pip
2023-12-04 17:58:18.820 | INFO | main:load_conf:25 - Get configration from env
Traceback (most recent call last):
File "/ql/data/repo/Chasing66_smzdm_bot/app/main.py", line 81, in
main()
File "/ql/data/repo/Chasing66_smzdm_bot/app/main.py", line 69, in main
msg += tasks.checkin()
File "/ql/data/repo/Chasing66_smzdm_bot/app/utils/smzdm_tasks.py", line 15, in checkin
resp = self.bot.request("POST", url)
File "/ql/data/repo/Chasing66_smzdm_bot/app/utils/smzdm_bot.py", line 92, in request
data = self.data(extra_data)
File "/ql/data/repo/Chasing66_smzdm_bot/app/utils/smzdm_bot.py", line 79, in data
"f": self.cookies_dict["device_smzdm"],
KeyError: 'device_smzdm'

执行结束... 2023-12-04 17:58:23 耗时 11 秒   

只设置了ANDROID_COOKIE这个环境变量,从web 端F12拿的 Cookie

检测不到tg bot的反向代理网址

平台是青龙面板,用的tg bot,京东脚本和阿里云正常通知,什么值得买没有通知,查看日志有这么一段:
notify.notify:tg_bot:105 - HTTPSConnectionPool(host='api.telegram.org', port=443): Max retries exceeded with url
这应该还是用的官方api吧,应该是没检测到的原因?这个要怎么办?

建议增加额外奖励的request

我抓了app的额外奖励的数据包,你加到脚本吧
import requests

headers = {
'User-Agent': '',
'request_key': '',
'Cookie': '',
'Content-Length': '95',
'Host': 'user-api.smzdm.com',
'Connection': 'Keep-Alive',
'Accept-Encoding': 'gzip',
}

data = {
'sign': 'AB1D963858B517E6FF6601AF80204162',
'weixin': '0',
'time': '16xxxxxxxx',
'basic_v': '0',
'f': 'android',
'v': '10.4.26',
}

response = requests.post('https://user-api.smzdm.com/checkin/extra_reward', headers=headers, data=data)

但判断是否有额外奖励应该在https://user-api.smzdm.com/vip的res里标注,我没有对比过。建议能加上判断后再request会比较好

[2023-01-14] 登录验证失败

Run python main.py
2023-01-14 10:23:51.416 | INFO | main:main:90 - Get configration from env
2023-01-14 10:23:52.459 | ERROR | main:checkin:74 - Faile to sign in
2023-01-14 10:23:52.459 | INFO | notify.notify:push_plus:24 - ⚠️ PUSH_PLUS_TOKEN not set, skip PushPlus nofitication
2023-01-14 10:23:52.459 | INFO | notify.notify:server_chain:48 - ⚠️ SC_KEY not set, skip ServerChain notification
2023-01-14 10:23:52.459 | INFO | notify.notify:tg_bot:69 - ⚠️ TG_BOT_TOKEN & TG_USER_ID not set, skip TelegramBot notification
2023-01-14 10:23:52.459 | ERROR | main:main:116 - Fail the Github action job
Error: Process completed with exit code 1.

报错啦

build
Process completed with exit code 1.
SMZDM Check-in Bot: .github#L1
ubuntu-latest workflows will use ubuntu-22.04 soon. For more details, see actions/runner-images#6399

请问下大佬,docker目录该怎么映射

上几个版本,都在环境里设置就行了,最新版本,环境里设置,说获取不到cookie,所以想问问大佬,能否给个目录映射,好方便改config

action自动签到失效是何解?只能手动运行。

on:
workflow_dispatch:

Uncomment below to schedule your job

schedule:
- cron: "0 18 * * *"

修改注释,cron表达式也改过,貌似都不行,是不是还需要调整代码或者设置哪里?因为以前使用过某项目的签到都能自动运行,本项目不知如何实现自动功能。

通知错误

2023-01-11 11:30:28.091 | ERROR | notify.notify:tg_bot:87 - No connection adapters were found for '/bot***/sendMessage'

IOS Sign key不相同

参考sign部分逻辑时发现一直提示:check Sign Fail,经过反编译发现ios和android端的sign key不一样。

android sign key: apr1$AwP!wRRT$gJ/q.X24poeBInlUJC

ios sign key: zok5JtAq3$QixaA%mncn*jGWlEpSL3E1

给需要的朋友一个参考。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.