Skip to content

Commit

Permalink
Merge pull request bighammer-link#15 from LuoHui666/main
Browse files Browse the repository at this point in the history
  • Loading branch information
bighammer-link authored Oct 15, 2024
2 parents 31bcf51 + 59b77dc commit dfaa12f
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 34 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Run sign
env:
SCKEY: ${{ secrets.SCKEY }}
EMAIL: ${{ secrets.EMAIL }}
PASSWD: ${{ secrets.PASSWD }}
EMAIL: ${{ vars.EMAIL }}
PASSWD: ${{ vars.PASSWD }}
run: |
python3 ./main.py
42 changes: 42 additions & 0 deletions .github/workflows/main2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: "Airport Checkin"

on:
schedule:
- cron: "0 22 * * *" # scheduled at 06:00 (UTC+8) everyday
workflow_dispatch:

env:
RUN_ENV: 'prod'

jobs:
build:
runs-on: ubuntu-latest
# if: github.ref == 'refs/heads/master'

steps:
- name: Checkout master
uses: actions/checkout@v2
with:
fetch-depth: 0
# ref: master

- name: Set up python
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Random sleep
if: github.event_name == 'schedule'
run: sleep $(shuf -i 10-100 -n 1)

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run sign
env:
SCKEY: ${{ secrets.SCKEY }}
EMAIL: ${{ secrets.EMAIL }}
PASSWD: ${{ secrets.PASSWD }}
run: |
python3 ./main.py
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
1. 右上角Fork此仓库
2. 然后到`Settings``Secrets and variables``Actions` 新建以下参数:

| 参数 | 内容 |
| ------------ | ------------ |
| EMAIL | 账号邮箱 |
| PASSWD | 账号密码 |
| SCKEY | Sever酱密钥 |
| TOKEN | pushplus密钥 |
| 参数 | 内容 | 变量类型 |
| ------------ | ------------ | ------------ |
| EMAIL | 账号邮箱 | Variables |
| PASSWD | 账号密码 | Variables |
| SCKEY | Sever酱密钥 | Secrets |
| TOKEN | pushplus密钥 | Secrets |

3.`Actions`中创建一个workflow,运行一次,以后每天项目都会自动运行。
4. 最后,可以到Run sign查看签到情况,同时也会也会将签到详情推送到Sever酱。
58 changes: 32 additions & 26 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@

session = requests.session()
# 配置用户名(一般是邮箱)
email = os.environ.get('EMAIL')
# email = os.environ.get('EMAIL')
# 配置用户名对应的密码 和上面的email对应上
passwd = os.environ.get('PASSWD')
# passwd = os.environ.get('PASSWD')
# 从设置的环境变量中的Variables多个邮箱和密码 ,分割
emails = os.environ.get('EMAIL', '').split(',')
passwords = os.environ.get('PASSWD', '').split(',')

# server酱
SCKEY = os.environ.get('SCKEY')
# PUSHPLUS
Expand All @@ -24,33 +28,35 @@ def push(content):

# 会不定时更新域名,记得Sync fork

login_url = 'https://ikuuu.me/auth/login'
check_url = 'https://ikuuu.me/user/checkin'
info_url = 'https://ikuuu.me/user/profile'
login_url = 'https://ikuuu.pw/auth/login'
check_url = 'https://ikuuu.pw/user/checkin'
info_url = 'https://ikuuu.pw/user/profile'

header = {
'origin': 'https://ikuuu.me',
'origin': 'https://ikuuu.pw',
'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36'
}
data = {

for email, passwd in zip(emails, passwords):
session = requests.session()
data = {
'email': email,
'passwd': passwd
}
try:
print('进行登录...')
response = json.loads(session.post(url=login_url,headers=header,data=data).text)
print(response['msg'])
# 获取账号名称
info_html = session.get(url=info_url,headers=header).text
# info = "".join(re.findall('<span class="user-name text-bold-600">(.*?)</span>', info_html, re.S))
# print(info)
# 进行签到
result = json.loads(session.post(url=check_url,headers=header).text)
print(result['msg'])
content = result['msg']
# 进行推送
push(content)
except:
content = '签到失败'
print(content)
push(content)
}
try:
print(f'[{email}] 进行登录...')
response = json.loads(session.post(url=login_url,headers=header,data=data).text)
print(response['msg'])
# 获取账号名称
# info_html = session.get(url=info_url,headers=header).text
# info = "".join(re.findall('<span class="user-name text-bold-600">(.*?)</span>', info_html, re.S))
# 进行签到
result = json.loads(session.post(url=check_url,headers=header).text)
print(result['msg'])
content = result['msg']
# 进行推送
push(content)
except:
content = '签到失败'
print(content)
push(content)

0 comments on commit dfaa12f

Please sign in to comment.