修改变量及添加代理访问

This commit is contained in:
yowiv
2025-03-06 05:00:34 +08:00
committed by GitHub
parent a7332f5a83
commit cdf168d34b
2 changed files with 14 additions and 44 deletions

View File

@@ -6,17 +6,17 @@ NodeSeek论坛签到借助github action或青龙面板 自动触发,默认
需要自行在setting中添加 Repository secrets
如果显示"USER NOT FOUND"就是cookie失效了需要重新抓
如果显示"USER NOT FOUND"或显示实际响应内容显示html就是cookie失效了需要重新抓
| 名称 | 含义 |
| :----: | :-----------------------------------: |
| COOKIE | 论坛用户cookie自行在浏览器F12中查看 |
| PUSHPLUS_TOKEN | pushplus中的用户token用于推送,非必需 |
| TELEGRAM_BOT_TOKEN | 电报token,非必需 |
| CHAT_ID | 电报chatid非必需 |
| THREAD_ID | 电报超级群组话题id,非必需 |
| TELEGRAM_API_URL | 代理api,非必需 |
| NS_COOKIE | 论坛用户cookie自行在浏览器F12中查看 |
| TG_BOT_TOKEN | tg 机器人的 TG_BOT_TOKEN1407203283:AAG9rt-6RDaaX0HBLZQq0laNOh898iFYaRQ,非必需 |
| TG_USER_ID | tg 机器人的 TG_USER_ID1434078534,非必需 |
| TG_THREAD_ID | tg 机器人的 TG_THREAD_ID 超级群组话题id非必需 |
| PROXY | 代理服务器地址格式如http://username:password@127.0.0.1:7890 或 http://127.0.0.1:7890,非必需 |
| USE_PROXY | 是否使用代理true或false默认为false,非必需 |
## 青龙面板
@@ -24,6 +24,3 @@ NodeSeek论坛签到借助github action或青龙面板 自动触发,默认
```
ql raw https://raw.githubusercontent.com/YYWO/NodeSeek-Signin/main/nodeseek_sign.py
```
| 名称 | 含义 |
| :----: | :-----------------------------------: |
| NS_COOKIE | 论坛用户cookie自行在浏览器F12中查看 |

View File

@@ -7,33 +7,8 @@ NS_RANDOM = os.environ.get("NS_RANDOM","true")
NS_COOKIE = os.environ.get("NS_COOKIE","")
COOKIE = os.environ.get("COOKIE", "")
COOKIE_ENV = NS_COOKIE or COOKIE
pushplus_token = os.environ.get("PUSHPLUS_TOKEN")
telegram_bot_token = os.environ.get("TELEGRAM_BOT_TOKEN","")
chat_id = os.environ.get("CHAT_ID","")
thread_id = os.environ.get("THREAD_ID","")
telegram_api_url = os.environ.get("TELEGRAM_API_URL","https://api.telegram.org") # 代理api,可以使用自己的反代
def telegram_Bot(token,chat_id,message):
url = f'{telegram_api_url}/bot{token}/sendMessage'
data = {
'chat_id': chat_id,
'message_thread_id': thread_id,
'text': message
}
r = requests.post(url, json=data)
response_data = r.json()
msg = response_data['ok']
print(f"telegram推送结果{msg}\n")
def pushplus_ts(token, rw, msg):
url = 'https://www.pushplus.plus/send/'
data = {
"token": token,
"title": rw,
"content": msg
}
r = requests.post(url, json=data)
msg = r.json().get('msg', None)
print(f'pushplus推送结果{msg}\n')
PROXY = os.environ.get("PROXY", "") # 代理地址格式如http://username:password@127.0.0.1:7890 或 http://127.0.0.1:7890
USE_PROXY = os.environ.get("USE_PROXY", "false").lower() == "true" # 是否使用代理默认为false
def load_send():
global send
@@ -69,7 +44,11 @@ if COOKIE_ENV:
}
try:
response = requests.post(url, headers=headers,impersonate="chrome110")
if USE_PROXY and PROXY:
print(f"使用代理: {PROXY}")
response = requests.post(url, headers=headers, impersonate="chrome110", proxies={"http": PROXY, "https": PROXY})
else:
response = requests.post(url, headers=headers, impersonate="chrome110")
response_data = response.json()
print(response_data)
print(COOKIE_ENV)
@@ -78,14 +57,8 @@ if COOKIE_ENV:
send("nodeseek签到", message)
if success == "true":
print(message)
if telegram_bot_token and chat_id:
telegram_Bot(telegram_bot_token, chat_id, message)
else:
print(message)
if telegram_bot_token and chat_id:
telegram_Bot(telegram_bot_token, chat_id, message)
if pushplus_token:
pushplus_ts(pushplus_token, "nodeseek签到", message)
except Exception as e:
print("发生异常:", e)
print("实际响应内容:", response.text)