├── .github └── workflows │ └── work.yml ├── Dockerfile ├── Enshan.py ├── README.md ├── entrypoint.sh └── requirements.txt /.github/workflows/work.yml: -------------------------------------------------------------------------------- 1 | name: 'run' 2 | 3 | on: 4 | schedule: 5 | - cron: '30 */8 * * *' 6 | workflow_dispatch: 7 | 8 | jobs: 9 | run: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v2 13 | - name: 'setup python' 14 | uses: actions/setup-python@master 15 | with: 16 | python-version: 3.7 17 | 18 | - name: requirements 19 | run : pip3 install -r requirements.txt 20 | 21 | - name: main 22 | env: 23 | cookie_enshan: ${{ secrets.cookie_enshan }} 24 | run: | 25 | python3 ../Enshan/Enshan.py 26 | 27 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3-alpine 2 | 3 | ENV cookie_enshan='' 4 | ENV SLEEP_SECONDS='86400' 5 | ENV TZ=Asia/Shanghai 6 | 7 | COPY . /app 8 | WORKDIR /app 9 | 10 | RUN pip3 install -i https://mirrors.ustc.edu.cn/pypi/web/simple pip -U 11 | RUN pip3 config set global.index-url https://mirrors.ustc.edu.cn/pypi/web/simple 12 | 13 | RUN pip3 install -r ./requirements.txt 14 | CMD ["sh", "./entrypoint.sh"] 15 | -------------------------------------------------------------------------------- /Enshan.py: -------------------------------------------------------------------------------- 1 | import requests, json, time, os, sys 2 | sys.path.append('.') 3 | requests.packages.urllib3.disable_warnings() 4 | try: 5 | from pusher import pusher 6 | except: 7 | pass 8 | from lxml import etree 9 | 10 | cookie = os.environ.get("cookie_enshan") 11 | 12 | def run(*arg): 13 | msg = "" 14 | s = requests.Session() 15 | s.headers.update({'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:85.0) Gecko/20100101 Firefox/85.0'}) 16 | 17 | # 签到 18 | url = "https://www.right.com.cn/forum/home.php?mod=spacecp&ac=credit&op=log&suboperation=creditrulelog" 19 | headers = { 20 | 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:85.0) Gecko/20100101 Firefox/85.0', 21 | 'Connection' : 'keep-alive', 22 | 'Host' : 'www.right.com.cn', 23 | 'Upgrade-Insecure-Requests' : '1', 24 | 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 25 | 'Accept-Language' : 'zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2', 26 | 'Accept-Encoding' : 'gzip, deflate, br', 27 | 'Cookie': cookie 28 | } 29 | try: 30 | r = s.get(url, headers=headers, timeout=120) 31 | # print(r.text) 32 | if '每天登录' in r.text: 33 | h = etree.HTML(r.text) 34 | data = h.xpath('//tr/td[6]/text()') 35 | msg += f'签到成功或今日已签到,最后签到时间:{data[0]}' 36 | else: 37 | msg += '签到失败,可能是cookie失效了!' 38 | pusher(msg) 39 | except: 40 | msg = '无法正常连接到网站,请尝试改变网络环境,试下本地能不能跑脚本,或者换几个时间点执行脚本' 41 | return msg + '\n' 42 | 43 | def main(*arg): 44 | msg = "" 45 | global cookie 46 | if "\\n" in cookie: 47 | clist = cookie.split("\\n") 48 | else: 49 | clist = cookie.split("\n") 50 | i = 0 51 | while i < len(clist): 52 | msg += f"第 {i+1} 个账号开始执行任务\n" 53 | cookie = clist[i] 54 | msg += run(cookie) 55 | i += 1 56 | print(msg[:-1]) 57 | return msg[:-1] 58 | 59 | 60 | if __name__ == "__main__": 61 | if cookie: 62 | print("----------恩山论坛开始尝试签到----------") 63 | main() 64 | print("----------恩山论坛签到执行完毕----------") 65 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Enshan 2 | ### 恩山论坛每日签到
3 | ### 使用方法
4 | Github Actions版本
5 | 1.点击项目右上角的Fork,Fork此项目
6 | 2.到自己Fork的项目点击Setting→Secrets→New secrets
7 | 3.Name填写cookie_enshan,Value填写 获取到的cookie
8 | 4.在"Actions"中的"run"下点击"Run workflow"即可手动执行签到,后续运行按照schedule,默认在每天凌晨0:30自动签到,可自行修改
9 |
10 |
11 | [腾讯云函数SCF](https://console.cloud.tencent.com/scf/index)的版本
12 | 1.下载requirements.zip所需库,到[层](https://console.cloud.tencent.com/scf/layer)里面新建一个层
13 | 2.到[函数服务](https://console.cloud.tencent.com/scf/list)里面新建一个函数,输入名字,运行环境选择python3.6,选择空白模板,下一步
14 | 3.修改执行方法为index.main,修改index.py文件,把SCF版py文件内容覆盖掉里面的函数,删除config.json
15 | 4.高级设置,添加多个环境变量key内输入:1.cookie_enshan 2.推送服务设置值(可选)
16 | value内输入:1.获取到的cookie 2.推送服务设置值(可选)
17 | 5.层配置,添加层,选择刚才新建的层。最后点完成
18 | 6.进入函数→触发管理→新建触发器,按自己需求定时启动
19 | 20 | ### Cookie获取方法
21 | 浏览器打开需要签到的网站并登录,F12打开检查
22 | 在 Chrome 浏览器下方的开发工具中单击 Network 标签页(其他浏览器大同小异)
23 | F5刷新当前网站,随便选一个Name里面的网页,在右侧Headers内找到Cookie: xxxxxx,复制xxxx的东西,一般很长一大串
24 | Headers如果没有Cookie就换另一个Name里面的网页,实在看不懂就自行baidu吧.jpg
25 | Cookie过期就必须手动更换,再重复一次获取流程,然后Github到secrets里更新,腾讯云函数就到函数配置中修改环境变量的值 26 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | while [ True ]; 4 | do 5 | python3 /app/Enshan.py; 6 | sleep $SLEEP_SECONDS; 7 | done 8 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | requests 2 | rsa 3 | beautifulsoup4 4 | cryptography 5 | lxml 6 | --------------------------------------------------------------------------------