Skip to content

Commit 4b1dc01

Browse files
authored
feat: add deepflood (#14)
1 parent 296b327 commit 4b1dc01

File tree

5 files changed

+90
-4
lines changed

5 files changed

+90
-4
lines changed

.circleci/config.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,21 @@ jobs:
4646
command: |
4747
python -m onepoint3acres.onepoint3acres
4848
49+
deepflood:
50+
docker:
51+
- image: cimg/python:3.11
52+
steps:
53+
- checkout
54+
- run:
55+
name: Install dependencies
56+
command: |
57+
python -m pip install --upgrade pip
58+
pip install curl_cffi python-dotenv
59+
- run:
60+
name: Run Deepflood signin
61+
command: |
62+
python -m deepflood.deepflood
63+
4964
workflows:
5065
# Allow manual triggers
5166
manual_trigger:
@@ -55,4 +70,6 @@ workflows:
5570
- v2ex:
5671
context: checkincontext
5772
- onepoint3acres:
73+
context: checkincontext
74+
- deepflood:
5875
context: checkincontext

.github/workflows/deploy-circleci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,4 +56,5 @@ jobs:
5656
store_secret "NODESEEK_COOKIE" "${{ secrets.NODESEEK_COOKIE }}"
5757
store_secret "V2EX_COOKIE" "${{ secrets.V2EX_COOKIE }}"
5858
store_secret "ONEPOINT3ACRES_COOKIE" "${{ secrets.ONEPOINT3ACRES_COOKIE }}"
59-
store_secret "TWOCAPTCHA_APIKEY" "${{ secrets.TWOCAPTCHA_APIKEY }}"
59+
store_secret "TWOCAPTCHA_APIKEY" "${{ secrets.TWOCAPTCHA_APIKEY }}"
60+
store_secret "DEEPFLOOD_COOKIE" "${{ secrets.DEEPFLOOD_COOKIE }}"

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
- **Nodeseek**
2020
- 自动签到
21+
- **Deepflood**
22+
- 自动签到
2123
- **V2EX**
2224
- 自动签到
2325
- **一亩三分地**
@@ -117,10 +119,10 @@ https://github.com/timerring/CloudCheckin/blob/0b719258ab4f5f746b067798eb2a4185a
117119
#### 配置签到平台
118120

119121
<details>
120-
<summary>配置 Nodeseek 签到</summary>
122+
<summary>配置 Nodeseek/Deepflood 签到</summary>
121123

122-
1. 从 Nodeseek 网站获取 `cookie`(获取方法请参考 [COOKIE 获取教程](https://blog.timerring.com/posts/the-way-to-get-cookie/)
123-
2.`cookie` 添加到仓库密钥中,命名为 `NODESEEK_COOKIE`
124+
1. 从 Nodeseek/Deepflood 网站获取 `cookie`(获取方法请参考 [COOKIE 获取教程](https://blog.timerring.com/posts/the-way-to-get-cookie/)
125+
2.`cookie` 添加到仓库密钥中,命名为 `NODESEEK_COOKIE`/`DEEPFLOOD_COOKIE`
124126
</details>
125127

126128

@@ -160,6 +162,7 @@ cp .env.localtest.example .env
160162

161163
# 运行签到脚本
162164
python -m nodeseek.nodeseek
165+
python -m deepflood.deepflood
163166
python -m v2ex.v2ex
164167
python -m onepoint3acres.onepoint3acres
165168
```

deepflood/__init__.py

Whitespace-only changes.

deepflood/deepflood.py

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import sys
2+
import os
3+
from curl_cffi import requests
4+
import random
5+
import time
6+
from dotenv import load_dotenv
7+
from telegram.notify import send_tg_notification
8+
9+
load_dotenv()
10+
11+
# Get COOKIE from environment variable, multiple cookies separated by &
12+
cookies = os.environ.get('DEEPFLOOD_COOKIE', '').strip()
13+
14+
if not cookies:
15+
raise ValueError("Environment variable DEEPFLOOD_COOKIE is not set")
16+
sys.exit(1)
17+
18+
# Split multiple cookies by & to form a list
19+
cookie_list = cookies.split('&')
20+
21+
# Request headers
22+
headers = {
23+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36 Edg/125.0.0.0',
24+
'Origin': 'https://www.deepflood.com',
25+
'Referer': 'https://www.deepflood.com/board',
26+
'Content-Type': 'application/json',
27+
}
28+
29+
# Iterate over multiple account cookies for check-in
30+
for idx, cookie in enumerate(cookie_list):
31+
32+
print(f"Using the {idx+1} account for check-in...", flush=True)
33+
# Generate a random delay
34+
random_delay = random.randint(1, 20)
35+
print(f"The {idx+1} account will wait for {random_delay} seconds...", flush=True)
36+
time.sleep(random_delay)
37+
38+
# Add cookie to headers
39+
headers['Cookie'] = cookie.strip()
40+
41+
try:
42+
# random=true means get a random bonus
43+
url = 'https://www.deepflood.com/api/attendance?random=true'
44+
response = requests.post(url, headers=headers, impersonate="chrome136")
45+
46+
# Output the status code and response content
47+
print(f"The {idx+1} account's Status Code: {response.status_code}", flush=True)
48+
print(f"The {idx+1} account's Response Content: {response.text}", flush=True)
49+
50+
# Check if the check-in is successful based on the response content
51+
if response.status_code == 200:
52+
success_message = f"DEEPFLOOD account {idx+1} check-in successful"
53+
print(success_message, flush=True)
54+
send_tg_notification(success_message)
55+
else:
56+
fail_message = f"DEEPFLOOD account {idx+1} check-in failed, response content: {response.text}"
57+
print(fail_message, flush=True)
58+
send_tg_notification(fail_message)
59+
sys.exit(1)
60+
61+
except Exception as e:
62+
error_message = f"DEEPFLOOD account {idx+1} check-in process error: {e}"
63+
print(error_message, flush=True)
64+
send_tg_notification(error_message)
65+
sys.exit(1)

0 commit comments

Comments
 (0)