mirror of
https://github.com/blusunny/qinglong.git
synced 2025-12-19 16:24:53 +08:00
Update ikuuu2.py
This commit is contained in:
155
ikuuu2.py
155
ikuuu2.py
@@ -2,56 +2,123 @@
|
|||||||
# -- coding: utf-8 --
|
# -- coding: utf-8 --
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
# @Author : github@wd210010 https://github.com/wd210010/just_for_happy
|
# @Author : github@wd210010 https://github.com/wd210010/just_for_happy
|
||||||
# @Time : 2023/3/27 13:23
|
# @Time : 2025/7/22 13:23
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
# cron "30 5 * * *" script-path=xxx.py,tag=匹配cron用
|
# cron "30 5 * * *" script-path=xxx.py,tag=匹配cron用
|
||||||
# const $ = new Env('IKuuu机场签到帐号版')
|
# const $ = new Env('IKuuu机场签到帐号版')
|
||||||
|
# 进入青龙容器
|
||||||
|
# docker exec -it qinglong bash
|
||||||
|
# apk update
|
||||||
|
# apk add chromium chromium-chromedriver
|
||||||
|
|
||||||
import requests,re
|
|
||||||
|
|
||||||
|
|
||||||
import requests
|
|
||||||
import os
|
import os
|
||||||
|
import re
|
||||||
|
import random
|
||||||
|
import requests
|
||||||
|
import json
|
||||||
|
from bs4 import BeautifulSoup
|
||||||
|
import undetected_chromedriver as uc # 使用 uc 避免手动管理 chromedriver
|
||||||
|
|
||||||
# export ikuuu='邮箱&密码' 多号#号隔开
|
def extract_and_select_url():
|
||||||
|
"""提取 ikuuu 的可用域名"""
|
||||||
|
options = uc.ChromeOptions()
|
||||||
|
options.add_argument("--headless") # 无界面模式
|
||||||
|
options.add_argument("--no-sandbox")
|
||||||
|
options.add_argument("--disable-dev-shm-usage")
|
||||||
|
options.add_argument("--disable-gpu")
|
||||||
|
options.add_argument("--disable-software-rasterizer")
|
||||||
|
|
||||||
def main():
|
# 关键:指定 chromium 的路径(Alpine 容器安装后在这里)
|
||||||
r = 1
|
options.binary_location = "/usr/bin/chromium-browser"
|
||||||
oy = ql_env()
|
|
||||||
print("共找到" + str(len(oy)) + "个账号")
|
# 如果你安装了 chromium-chromedriver,可以指定 driver_executable_path
|
||||||
for i in oy:
|
driver = uc.Chrome(options=options, driver_executable_path="/usr/bin/chromedriver")
|
||||||
print("------------正在执行第" + str(r) + "个账号----------------")
|
|
||||||
email = i.split('&')[0]
|
driver.get("http://ikuuu.club")
|
||||||
passwd = i.split('&')[1]
|
soup = BeautifulSoup(driver.page_source, 'html.parser')
|
||||||
sign_in(email, passwd)
|
driver.quit()
|
||||||
r += 1
|
|
||||||
def sign_in(email, passwd):
|
text_content = soup.get_text()
|
||||||
try:
|
urls = re.findall(r'ikuuu\.[a-zA-Z0-9]+\b', text_content)
|
||||||
body = {"email" : email,"passwd" : passwd,}
|
|
||||||
headers = {'user-agent':'Mozilla/5.0 (iPhone; CPU iPhone OS 13_2_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.3 Mobile/15E148 Safari/604.1'}
|
if urls:
|
||||||
res = requests.get('https://ikuuu.club/', headers=headers)
|
unique_urls = list(set(urls))
|
||||||
url = re.findall('target="_blank">(.*?)</a>', res.text, re.S)
|
selected_url = random.choice(unique_urls)
|
||||||
for i in range(len(url)):
|
return selected_url
|
||||||
resp = requests.session()
|
|
||||||
resp.post(f'{url[i]}auth/login', headers=headers, data=body)
|
|
||||||
ss = resp.post(f'{url[i]}user/checkin').json()
|
|
||||||
# print(ss)
|
|
||||||
if 'msg' in ss:
|
|
||||||
print(ss['msg'])
|
|
||||||
break
|
|
||||||
except:
|
|
||||||
print('请检查帐号配置是否错误')
|
|
||||||
def ql_env():
|
|
||||||
if "ikuuu" in os.environ:
|
|
||||||
token_list = os.environ['ikuuu'].split('#')
|
|
||||||
if len(token_list) > 0:
|
|
||||||
return token_list
|
|
||||||
else:
|
|
||||||
print("ikuuu变量未启用")
|
|
||||||
sys.exit(1)
|
|
||||||
else:
|
else:
|
||||||
print("未添加ikuuu变量")
|
return "未找到网址"
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main()
|
# 从环境变量读取账号信息
|
||||||
|
ACCOUNT_STR = os.getenv('ikuuu', '') # 格式:账号1&密码1#账号2&密码2
|
||||||
|
|
||||||
|
# 解析账号信息
|
||||||
|
ACCOUNTS = []
|
||||||
|
if ACCOUNT_STR:
|
||||||
|
account_pairs = ACCOUNT_STR.split('#')
|
||||||
|
for pair in account_pairs:
|
||||||
|
if '&' in pair:
|
||||||
|
email, password = pair.split('&', 1) # 只分割第一个&符号
|
||||||
|
ACCOUNTS.append({"email": email, "password": password})
|
||||||
|
|
||||||
|
if not ACCOUNTS:
|
||||||
|
print("未检测到账号信息,请设置环境变量 ikuuu")
|
||||||
|
print('格式示例:export ikuuu="账号1&密码1#账号2&密码2"')
|
||||||
|
exit()
|
||||||
|
|
||||||
|
DOMAIN = extract_and_select_url()
|
||||||
|
|
||||||
|
# 更新 URLs
|
||||||
|
LOGIN_URL = f"https://{DOMAIN}/auth/login"
|
||||||
|
CHECKIN_URL = f"https://{DOMAIN}/user/checkin"
|
||||||
|
|
||||||
|
COMMON_HEADERS = {
|
||||||
|
"User-Agent": "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Mobile Safari/537.36",
|
||||||
|
"X-Requested-With": "XMLHttpRequest"
|
||||||
|
}
|
||||||
|
|
||||||
|
def login_and_checkin(account):
|
||||||
|
"""处理单个账号的登录和签到"""
|
||||||
|
session = requests.Session()
|
||||||
|
|
||||||
|
# 登录请求
|
||||||
|
login_data = {
|
||||||
|
"host": DOMAIN.replace('https://', ''),
|
||||||
|
"email": account["email"],
|
||||||
|
"passwd": account["password"],
|
||||||
|
"code": ""
|
||||||
|
}
|
||||||
|
|
||||||
|
print(f"正在处理账号: {account['email']},使用域名: {DOMAIN}")
|
||||||
|
try:
|
||||||
|
login_response = session.post(LOGIN_URL, data=login_data, headers=COMMON_HEADERS)
|
||||||
|
print(json.loads(login_response.text)['msg'])
|
||||||
|
if login_response.status_code != 200:
|
||||||
|
print(f"登录失败! 状态码: {login_response.status_code}")
|
||||||
|
return False
|
||||||
|
|
||||||
|
# 签到请求
|
||||||
|
checkin_response = session.post(CHECKIN_URL, headers=COMMON_HEADERS)
|
||||||
|
|
||||||
|
if checkin_response.status_code == 200:
|
||||||
|
response_data = json.loads(checkin_response.text)
|
||||||
|
print(f"签到结果: {response_data.get('msg', '无返回消息')}")
|
||||||
|
return True
|
||||||
|
else:
|
||||||
|
print(f"签到失败! 状态码: {checkin_response.status_code}")
|
||||||
|
return False
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
print(f"处理账号 {account['email']} 时出错: {str(e)}")
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
print(f"检测到 {len(ACCOUNTS)} 个账号,开始签到...")
|
||||||
|
|
||||||
|
success_count = 0
|
||||||
|
for account in ACCOUNTS:
|
||||||
|
if login_and_checkin(account):
|
||||||
|
success_count += 1
|
||||||
|
|
||||||
|
print(f"\n签到完成! 成功处理 {success_count}/{len(ACCOUNTS)} 个账号")
|
||||||
|
|||||||
Reference in New Issue
Block a user