Files
lm_code/推特/main.py

797 lines
28 KiB
Python
Raw Normal View History

2026-01-15 15:06:37 +08:00
import threading
2025-12-01 14:14:17 +08:00
import time
2025-12-19 09:47:09 +08:00
import pyotp
import random
2025-12-08 16:07:14 +08:00
from concurrent.futures import ThreadPoolExecutor
2025-11-19 15:15:50 +08:00
from peewee import fn
2025-12-19 09:47:09 +08:00
from loguru import logger
from DrissionPage import ChromiumOptions, ChromiumPage
2025-11-19 15:15:50 +08:00
2025-11-28 18:22:38 +08:00
from bit_tools import openBrowser, createBrowser, get_group_lists, get_browser_lists_Browser
2026-01-15 13:43:12 +08:00
from db_init import ensure_tables, sync_xstart_from_bitbrowser
2025-11-19 15:15:50 +08:00
from models.ips import Ips
from models.xstart import Xstart
from models.xtoken import XToken
class Hub_Web:
2025-12-01 14:14:17 +08:00
def __init__(self, xstart_info, x_info=None):
2025-11-19 15:15:50 +08:00
self.xstart_info = xstart_info
self.x_info = x_info
self.page = None
self.x_tab = None
2025-12-08 17:01:20 +08:00
self.start() # 执行类时,就启动的方法
2025-12-08 16:20:22 +08:00
def start(self):
self.create_Browser() # 创建浏览器
if self.get_page():
2026-01-15 15:06:37 +08:00
logger.info(f",浏览器打开成功")
2025-12-08 16:20:22 +08:00
else:
2026-01-15 15:06:37 +08:00
logger.error(f",浏览器打开失败")
2025-12-08 16:20:22 +08:00
return
if self.login_x_main():
self.xstart_info.start = 1
self.xstart_info.save()
2026-01-15 15:06:37 +08:00
logger.success(f"登录x成功")
2025-12-08 16:20:22 +08:00
# time.sleep(25)
#
# for i in self.x_tab.cookies():
# if i["name"] == "auth_token":
# self.xstart_info.cookie = i["value"]
# self.xstart_info.save()
else:
2026-01-15 15:06:37 +08:00
logger.error(f"登录x失败")
2025-12-08 16:20:22 +08:00
self.xstart_info.start = 0
self.xstart_info.save()
def create_Browser(self):
if not self.xstart_info.bit_id:
if not self.xstart_info.ip_id:
self.ips_info = Ips.select().where(Ips.country == "法国").order_by(fn.Rand()).get()
self.xstart_info.ip_id = self.ips_info.id
self.xstart_info.save()
logger.info("没有浏览器,创建中。。。")
fz_datas = get_group_lists()
bit_id = createBrowser(
2026-01-15 15:06:37 +08:00
# name=self.x_info.user_name,
2025-12-23 11:12:32 +08:00
proxyType="http",
2025-12-08 16:20:22 +08:00
groupId=fz_datas['推特'],
2025-12-23 11:12:32 +08:00
host="104.168.59.92",
port=int(random.randint(20001, 25000)),
# proxyUserName=self.ips_info.username,
# proxyPassword=self.ips_info.password,
2025-12-08 16:20:22 +08:00
)
self.xstart_info.bit_id = bit_id
self.xstart_info.save()
2025-11-19 15:15:50 +08:00
def x_testing(self):
user_name = self.x_tab.ele(
'x://*[@id="react-root"]/div/div/div[2]/header/div/div/div/div[2]/div/button/div[2]/div/div[2]/div/div/div/span',
timeout=10,
)
if not user_name:
user_name = self.x_tab.ele(
'x://*[@id="react-root"]/div/div/div[2]/header/div/div/div/div[2]/div/button/div[2]/div/div/div/div[1]/span/span',
timeout=10,
)
2026-01-15 15:06:37 +08:00
return True
2025-11-19 15:15:50 +08:00
2026-01-15 15:06:37 +08:00
# if user_name and self.x_info.user_name.lower() == user_name.text.split("@")[-1].lower():
# return True
# else:
# return False
2025-11-19 15:15:50 +08:00
# self.x_tab.refresh()
# time.sleep(5)
#
# for i in self.x_tab.cookies():
# if i.get("name") == "auth_token":
# self.x_info.token = i.get("value")
# self.x_info.save()
#
# return True
# else:
# return False
def login_x(self):
try:
self.x_tab = self.page.new_tab('https://x.com/login')
time.sleep(5)
self.x_tab.ele('x://input[@autocomplete="username"]').input(self.x_info.user_name)
self.x_tab.ele('x:(//button[@role="button"])[3]').click()
self.x_tab.ele('x://input[@name="password"]').input(self.x_info.password)
self.x_tab.ele('x://button[@data-testid="LoginForm_Login_Button"]').click()
2025-11-19 15:59:38 +08:00
# 创建一个 TOTP 对象
totp = pyotp.TOTP(self.x_info.two_fa)
self.x_tab.ele('x://input[@data-testid="ocfEnterTextTextInput"]').input(totp.now())
2025-11-19 15:15:50 +08:00
self.x_tab.ele('x://button[@data-testid="ocfEnterTextNextButton"]').click()
time.sleep(5)
self.x_tab.ele('x://button[@data-testid="OAuth_Consent_Button"]').click()
if self.x_testing():
2025-11-19 15:59:38 +08:00
self.xstart_info.start = 1
self.xstart_info.save()
2025-11-19 15:15:50 +08:00
return True
else:
return False
except:
pass
return False
def get_page_tab(self, url):
for i in range(3):
try:
tab = self.page.get_tab(url=url)
return tab
except:
time.sleep(1)
def get_page(self, ):
try:
bit_port = openBrowser(id=self.xstart_info.bit_id)
co = ChromiumOptions()
co.set_local_port(port=bit_port)
self.page = ChromiumPage(addr_or_opts=co)
self.page.set.window.max()
2025-12-08 16:20:22 +08:00
time.sleep(5)
for _, i in enumerate(self.page.get_tabs()):
if _ == 0:
continue
i.close()
2025-11-19 15:15:50 +08:00
return True
except:
pass
return False
2025-12-08 16:20:22 +08:00
def get_x_start(self):
if self.login_x_main():
self.xstart_info.start = 1
self.xstart_info.save()
2026-01-15 15:06:37 +08:00
logger.success(f"登录x成功")
2025-12-08 16:20:22 +08:00
# time.sleep(25)
#
# for i in self.x_tab.cookies():
# if i["name"] == "auth_token":
# self.xstart_info.cookie = i["value"]
# self.xstart_info.save()
else:
2026-01-15 15:06:37 +08:00
logger.error(f"登录x失败")
2025-12-08 16:20:22 +08:00
self.xstart_info.start = 0
self.xstart_info.save()
2025-11-19 15:15:50 +08:00
def login_x_main(self):
self.x_tab = self.page.new_tab('https://x.com/login')
if self.x_testing():
return True
else:
2026-01-15 15:06:37 +08:00
logger.info(f"开始登录x。。。")
2025-11-19 15:15:50 +08:00
if self.login_x():
return True
else:
return False
def get_txt(self):
with open('推文.txt', 'r', encoding='utf-8') as f:
content = f.read()
tasks = [] # 创建任务列表
2025-12-08 16:30:43 +08:00
lines = content.split('\n')
2025-11-19 15:15:50 +08:00
print(lines)
# 随机选择一个段落
random_paragraph = random.choice(lines)
return random_paragraph
def get_soon_txt(self):
with open('soon推文.txt', 'r', encoding='utf-8') as f:
content = f.read()
tasks = [] # 创建任务列表
lines = content.split('\n\n')
print(lines)
# 随机选择一个段落
random_paragraph = random.choice(lines)
return random_paragraph
def tweet_about_sui_chain(self):
self.x_tab.ele('x://div[@class="public-DraftStyleDefault-block public-DraftStyleDefault-ltr"]').input(
self.get_txt())
time.sleep(5)
self.x_tab.ele(
'x://span[@class="css-1jxf684 r-dnmrzs r-1udh08x r-1udbk01 r-3s2u2q r-bcqeeo r-1ttztb7 r-qvutc0 r-poiln3 r-a023e6 r-rjixqe"]//span[@class="css-1jxf684 r-bcqeeo r-1ttztb7 r-qvutc0 r-poiln3"]').click()
if self.hub_web_info.x_num:
self.hub_web_info.x_num += 1
else:
self.hub_web_info.x_num = 1
self.hub_web_info.save(only=[HubWeb.x_num])
def soon_action(self):
for i in range(3):
okx_tab = self.get_page_tab(url="mcohilncbfahbmgdjkbpemcciiolgcge")
if okx_tab:
okx_tab.close()
okx_wallet_tab = self.page.new_tab(
url="chrome-extension://mcohilncbfahbmgdjkbpemcciiolgcge/popup.html#/initialize")
time.sleep(5)
if "initialize" in okx_wallet_tab.url:
okx_wallet_tab.ele('x:(//button[@data-testid="okd-button"])[last()]').click()
okx_wallet_tab.ele(
'x://div[@class="_wallet-list__item_1kyzd_4 _wallet-list__item__hover_1kyzd_8 _wallet-list__cell_1kyzd_26 _listCell_q2vqq_29"]').click()
time.sleep(5)
okx_wallet_tab = self.get_page_tab(url="mcohilncbfahbmgdjkbpemcciiolgcge")
soon_wallet_info = CjjSoo.get_or_none(
CjjSoo.id == self.hub_web_info.soon_wallet_id
)
for ele, text in zip(okx_wallet_tab.eles('x://input[@class="mnemonic-words-inputs__container__input"]'),
soon_wallet_info.mnemonic.split(
" ")):
ele.input(text)
okx_wallet_tab.ele('x://button[@data-testid="okd-button"]').click()
okx_wallet_tab.ele('x:(//div[@class="_item-content_1cywj_42"])[last()]').click()
okx_wallet_tab.ele('x://span[@class="btn-content"]').click()
okx_wallet_tab.ele('x://input[@data-testid="okd-input"]').input("12345678")
okx_wallet_tab.ele('x:(//input[@data-testid="okd-input"])[last()]').input("12345678")
okx_wallet_tab.ele('x:(//span[@class="btn-content"])[last()]').click()
time.sleep(10)
okx_wallet_tab.ele('x:(//span[@class="btn-content"])[last()]').click()
if "unlock" in okx_wallet_tab.url:
okx_wallet_tab.ele('x://input[@data-testid="okd-input"]').input("12345678")
okx_wallet_tab.ele('x://button[@data-testid="okd-button"]').click()
time.sleep(5)
okx_wallet_tab.close()
soon_tab = self.page.new_tab(url="https://redpill.soo.network/ ")
sign_ele = soon_tab.ele('x://button[text()="Sign"]', timeout=5)
if sign_ele:
sign_ele.click()
time.sleep(5)
okx_wallet_tab = self.page.get_tab(url="mcohilncbfahbmgdjkbpemcciiolgcge")
okx_wallet_tab.ele('x:(//button[@data-testid="okd-button"])[last()]').click()
time.sleep(10)
sign_ele = soon_tab.ele('x://button[text()="Sign In"]', timeout=5)
if sign_ele:
sign_ele.click()
soon_tab.ele('x://button[contains(text(), "OKX")]').click()
time.sleep(5)
okx_wallet_tab = self.page.get_tab(url="mcohilncbfahbmgdjkbpemcciiolgcge")
okx_wallet_tab.ele('x:(//button[@data-testid="okd-button"])[last()]').click()
time.sleep(5)
sign_ele = soon_tab.ele('x://button[text()="Sign"]', timeout=5)
if sign_ele:
sign_ele.click()
time.sleep(5)
okx_wallet_tab = self.page.get_tab(url="mcohilncbfahbmgdjkbpemcciiolgcge")
okx_wallet_tab.ele('x:(//button[@data-testid="okd-button"])[last()]').click()
time.sleep(10)
soon_ele = soon_tab.ele('x://div[@class="group relative cursor-pointer"]', timeout=3)
if soon_ele:
soon_ele.click()
time.sleep(3)
soon_ele = soon_tab.ele('x://button[text()="Yes"]', timeout=3)
if soon_ele:
soon_ele.click()
time.sleep(3)
soon_ele = soon_tab.ele('x://button[text()="Confirm"]', timeout=3)
if soon_ele:
soon_ele.click()
time.sleep(3)
soon_ele = soon_tab.ele('x://button[text()="Connect X to Start My Journey"]', timeout=3)
if soon_ele:
soon_ele.click()
time.sleep(5)
soon_ele = soon_tab.ele('x://button[@data-testid="OAuth_Consent_Button"]', timeout=15)
if soon_ele:
soon_ele.click()
# -------------------------------------------------------------------------------------
x_tab = self.page.new_tab(url="https://x.com/intent/post?text=.%20%40soon_svm&hashtags=SOONISTHEREDPILL")
x_tab = self.page.get_tab(url="SOONISTHEREDPILL")
x_tab.ele('x://div[@class="false draftjs-styles_0 "]').input(self.get_soon_txt())
time.sleep(5)
x_tab.ele('x://button[@data-testid="tweetButton"]').click()
time.sleep(5)
x_tab.ele('x://button[@data-testid="tweetButton"]').click()
time.sleep(15)
2025-11-20 10:48:28 +08:00
def get_urls(self):
tab = self.page.new_tab()
tab.listen.start("https://x.com/i/api/graphql")
2025-11-20 11:15:05 +08:00
tab.get(url=f"https://x.com/{self.x_info.user_name}")
2025-11-20 10:48:28 +08:00
url_id = ""
2025-11-20 11:12:28 +08:00
2025-12-08 16:07:14 +08:00
try:
res = tab.listen.wait(timeout=25) # 等待并获取一个数据包
for i in res.response.body["data"]['user']['result']["timeline"]['timeline']["instructions"][1][
"entries"]:
if "tweet" in i["entryId"]:
new_string = i["entryId"].replace("tweet-", "")
url_id += new_string + ";"
except:
pass
2025-11-20 10:48:28 +08:00
self.xstart_info.url_id = url_id
self.xstart_info.save()
2025-11-20 11:11:38 +08:00
def to_li(self):
2025-11-20 11:31:02 +08:00
xtoken_info = XToken.select().where(XToken.start == 1).order_by(fn.Rand()).get()
2025-11-20 11:38:23 +08:00
xstart_info = Xstart.get_or_none(
x_id=xtoken_info.id,
2025-11-20 11:31:02 +08:00
)
result = xstart_info.url_id.split(';')
# 去除可能存在的空字符串元素
result = [item for item in result if item]
for i in result:
tab = self.page.new_tab(url=f"https://x.com/{xtoken_info.user_name}/status/{i}")
2025-11-20 11:31:18 +08:00
time.sleep(random.randint(1, 10))
2025-11-20 11:11:38 +08:00
2025-11-20 11:42:24 +08:00
if random.randint(1, 11) > 5:
2025-11-20 11:46:56 +08:00
# tab.ele(
# 'x:/html/body/div[1]/div/div/div[2]/main/div/div/div/div/div/section/div/div/div[1]/div/div/article/div/div/div[3]/div[5]/div/div/div[2]/button').click()
tab.actions.click(
'x:/html/body/div[1]/div/div/div[2]/main/div/div/div/div/div/section/div/div/div[1]/div/div/article/div/div/div[3]/div[5]/div/div/div[2]/button')
time.sleep(random.randint(1, 5))
# tab.ele(
# 'x:/html/body/div[1]/div/div/div[1]/div[2]/div/div/div/div[2]/div/div[3]/div/div/div/div').click()
tab.actions.click(
'x:/html/body/div[1]/div/div/div[1]/div[2]/div/div/div/div[2]/div/div[3]/div/div/div/div')
2025-11-20 11:42:24 +08:00
time.sleep(random.randint(1, 10))
if random.randint(1, 11) > 5:
2025-11-20 11:46:56 +08:00
# tab.ele(
# 'x:/html/body/div[1]/div/div/div[2]/main/div/div/div/div/div/section/div/div/div[1]/div/div/article/div/div/div[3]/div[5]/div/div/div[3]/button').click()
tab.actions.click(
'x:/html/body/div[1]/div/div/div[2]/main/div/div/div/div/div/section/div/div/div[1]/div/div/article/div/div/div[3]/div[5]/div/div/div[3]/button')
2025-11-20 11:42:24 +08:00
time.sleep(random.randint(1, 10))
2025-11-24 11:06:13 +08:00
def account_nurturing(self):
2025-12-09 13:34:44 +08:00
# self.start()
2025-12-08 16:07:14 +08:00
titles = ["Bianca", "币安", "OKX", "bitget", "bybit", "mexc"]
random_element = random.choice(titles)
self.page.get(url=f"https://x.com/search?q={random_element}")
2025-11-24 11:06:13 +08:00
names = []
for i1 in range(random.randint(10, 20)):
eles = self.page.eles(
'x:/html/body/div[1]/div/div/div[2]/main/div/div/div/div[1]/div/div[3]/section/div/div/div', timeout=5)
i = random.choice(eles)
ele = i.ele(
'x:./div/div/article/div/div/div[2]/div[2]/div[1]/div/div[1]/div/div/div[1]/div/a/div/div[1]/span/span',
timeout=0.5)
if not ele:
continue
if ele.text in names:
continue
names.append(ele.text)
self.page.actions.scroll(on_ele=ele)
time.sleep(1)
self.page.actions.click(on_ele=ele)
# 关注
if random.randint(1, 11) > 5:
ele = self.page.ele('x://span[text()="Follow"]', timeout=0.5)
if ele:
self.page.actions.click(on_ele=ele)
for i in range(random.randint(1, 10)):
eles = self.page.eles(
'x://*[@id="react-root"]/div/div/div[2]/main/div/div/div/div[1]/div/div[3]/div/div/section/div/div/div',
timeout=5)
i = random.choice(eles)
ele = i.ele('x:.//div/div/article', timeout=5)
if ele:
self.page.actions.scroll(on_ele=ele)
time.sleep(1)
self.page.actions.click(on_ele=ele)
time.sleep(random.randint(1, 10))
self.page.actions.scroll(
on_ele='x:/html/body/div[1]/div/div/div[1]/div[2]/div/div/div/div/div/div[2]/div[2]/div/div[2]/section/div/div/div[1]/div/div/article/div/div/div[3]/div[5]/div/div/div[3]/button/div/div[1]')
time.sleep(random.randint(1, 5))
if random.randint(1, 11) > 5:
self.page.actions.click(
'x:/html/body/div[1]/div/div/div[1]/div[2]/div/div/div/div/div/div[2]/div[2]/div/div[2]/section/div/div/div[1]/div/div/article/div/div/div[3]/div[5]/div/div/div[2]/button')
time.sleep(random.randint(1, 5))
self.page.actions.click(
'x:/html/body/div[1]/div/div/div[1]/div[3]/div/div/div/div[2]/div/div[3]/div/div/div/div/div[2]/div')
time.sleep(random.randint(1, 10))
if random.randint(1, 11) > 5:
self.page.actions.click(
'x:/html/body/div[1]/div/div/div[1]/div[2]/div/div/div/div/div/div[2]/div[2]/div/div[2]/section/div/div/div[1]/div/div/article/div/div/div[3]/div[5]/div/div/div[3]/button/div/div[1]')
time.sleep(random.randint(1, 10))
self.page.back()
time.sleep(random.randint(1, 10))
self.page.scroll(random.randint(500, 1000))
self.page.back()
time.sleep(random.randint(1, 10))
self.page.scroll(random.randint(500, 1000))
2025-12-08 17:01:20 +08:00
if random.randint(1, 11) > 5:
self.FollowTwitterAccount()
2025-12-01 14:14:17 +08:00
def get_name(self):
self.x_tab = self.page.new_tab('https://x.com/login')
user_name = self.x_tab.ele(
'x://*[@id="react-root"]/div/div/div[2]/header/div/div/div/div[2]/div/button/div[2]/div/div[2]/div/div/div/span',
timeout=10,
)
if not user_name:
user_name = self.x_tab.ele(
'x://*[@id="react-root"]/div/div/div[2]/header/div/div/div/div[2]/div/button/div[2]/div/div/div/div[1]/span/span',
timeout=10,
)
if user_name:
for i in XToken.select():
if i.user_name.lower() == user_name.text.split("@")[-1].lower():
self.xstart_info.x_id = i.id
self.xstart_info.save()
return True
else:
return False
2025-12-08 16:29:21 +08:00
def to_do_tui(self):
self.start()
# 发推
try:
# self.x_tab.get("https://x.com/home")
time.sleep(random.randint(3, 15))
# text = "Websea顶级渠道注册就可享受websea合约85%返佣,量大可谈,欢迎代理咨询。 TG飞机http://t.me/webseadds"
text = self.get_txt()
2025-12-15 23:04:32 +08:00
text = """
💡 Websea Futures Insurance 2.0 FAQ
What is "Referral-Based Rate Reduction"?
🤝 For every friend you successfully invite, your insurance fee rate drops by 1%, up to a maximum of 5%!
A friend counts as a successful boost once they register and reach a total insurance premiums of 10 USDT within 7 days.
Your friend also receives 1 reward node after completing registration.
Winwin benefits dont miss out! 🚀
"""
2025-12-08 16:29:21 +08:00
2025-12-09 16:18:35 +08:00
self.xstart_info.url_id = text
self.xstart_info.save()
2025-12-15 23:04:32 +08:00
self.x_tab.actions.click(
'x://*[@id="react-root"]/div/div/div[2]/main/div/div/div/div/div/div[3]/div/div[2]/div[1]/div/div/div/div[2]/div[2]/div[2]/div/div/nav/div/div[2]/div/div[1]/div/button').input(
[r"E:\新建文件夹\6194986263283174596.jpg"])
2025-12-08 16:29:21 +08:00
self.x_tab.actions.click(
'x://*[@id="react-root"]/div/div/div[2]/main/div/div/div/div/div/div[3]/div/div[2]/div[1]/div/div/div/div[2]/div[1]/div/div/div/div/div/div/div/div/div/div/div/div[1]/div/div/div/div/div/div[2]/div/div/div/div').input(
text)
time.sleep(random.randint(3, 15))
2025-12-09 16:18:35 +08:00
for i in range(3):
self.x_tab.actions.click(
on_ele='x://*[@id="react-root"]/div/div/div[2]/main/div/div/div/div/div/div[3]/div/div[2]/div[1]/div/div/div/div[2]/div[2]/div[2]/div/div/div/button')
time.sleep(1)
2025-12-08 16:29:21 +08:00
time.sleep(5)
2025-12-09 16:18:35 +08:00
except Exception as e:
print(e)
2025-12-08 16:29:21 +08:00
2025-12-08 16:38:40 +08:00
def end(self):
self.page.quit()
def __enter__(self):
return self
def __exit__(self, exc_type, exc_value, traceback):
self.end()
2025-12-08 17:01:20 +08:00
def FollowTwitterAccount(self):
# 点击关注
2025-12-10 16:51:41 +08:00
# tab = self.page.new_tab(url="https://x.com/CryptoStart_App")
2025-12-29 18:29:21 +08:00
tab = self.page.new_tab(url="https://x.com/Websea_MY")
2025-12-08 17:01:20 +08:00
time.sleep(10)
2025-12-29 18:29:21 +08:00
# ele = tab.ele('x://span[text()="Follow"]', timeout=0.5)
# if ele:
# tab.actions.click(on_ele=ele)
# time.sleep(10)
tab.actions.click(
on_ele='x://*[@id="react-root"]/div/div/div[2]/main/div/div/div/div[1]/div/div[3]/div/div/div[1]/div[1]/div[1]/div[2]/div/div[1]/button/div/span/span')
2025-12-08 17:01:20 +08:00
for i in range(random.randint(1, 10)):
tab.actions.scroll(delta_y=random.randint(400, 800))
time.sleep(random.randint(3, 10))
2025-12-18 09:45:07 +08:00
def 回复(self):
2025-12-18 11:34:19 +08:00
urls = [
2025-12-29 18:29:21 +08:00
"https://x.com/Websea_MY/status/2004081342364123146",
2026-01-15 12:31:45 +08:00
"https://x.com/Websea_MY/status/2003669526492405904",
"https://x.com/Websea_MY/status/2001119115575222779",
"https://x.com/Websea_MY/status/2001180999443734677"
2025-12-18 11:34:19 +08:00
]
tests = [
2025-12-29 18:29:21 +08:00
"O seguro de futuros da Websea ultrapassou oficialmente a marca de 400 rodadas de airdrops! 🚀 Contacte TGwebseatom 85% de reembolso",
"Websea #FuturesInsurance официально преодолела отметку в 400 раундов аирдропов! 🚀Свяжитесь с TGwebseatom 85% кэшбэк",
"¡Websea #FuturesInsurance ha superado oficialmente las 400 rondas de airdrops! 🚀Póngase en contacto con TGwebseatom 85 % de reembolso",
"Websea #FuturesInsurance has officially surpassed 400 rounds of airdrops! 🚀 Contact TGwebseatom 85% cashback",
"Websea #FuturesInsurance đã chính thức vượt qua 400 đợt airdrop! 🚀Liên hệ TGwebseatom 85% hoàn tiền",
2025-12-18 11:34:19 +08:00
]
tab = self.page.new_tab(random.choice(urls))
tab.actions.click(
'x:/html/body/div[1]/div/div/div[2]/main/div/div/div/div[1]/div/section/div/div/div[1]/div/div/article/div/div/div[3]/div[5]/div/div/div[2]/button')
time.sleep(random.randint(1, 5))
tab.actions.click(
'x:/html/body/div[1]/div/div/div[1]/div[2]/div/div/div/div[2]/div/div[3]/div/div/div/a[1]')
time.sleep(random.randint(1, 5))
2025-12-19 09:47:09 +08:00
# tab.actions.type(random.choice(tests))
tab.ele(
'x:/html/body/div[1]/div/div/div[1]/div[2]/div/div/div/div/div/div[2]/div[2]/div/div/div/div[3]/div[2]/div[1]/div/div/div/div[1]/div[2]/div/div/div/div/div/div/div/div/div/div/div[1]/div/div[1]/div/div/div/div/div/div[2]/div/div/div/div').input(
random.choice(tests))
2025-12-18 11:34:19 +08:00
time.sleep(random.randint(1, 5))
2025-12-19 09:47:09 +08:00
for i in range(3):
try:
tab.actions.click(
'x:/html/body/div[1]/div/div/div[1]/div[2]/div/div/div/div/div/div[2]/div[2]/div/div/div/div[3]/div[2]/div[1]/div/div/div/div[2]/div[2]/div/div/div/button/div/span/span')
except:
pass
2025-12-18 11:34:19 +08:00
2025-12-19 09:47:09 +08:00
time.sleep(random.randint(1, 5))
2025-12-18 11:34:19 +08:00
time.sleep(random.randint(5, 15))
2025-12-18 09:45:07 +08:00
2025-12-08 16:20:22 +08:00
# def action(self):
# if not self.xstart_info.bit_id:
# self.xstart_info.ip_id = self.ips_info.id
# self.xstart_info.save()
#
# logger.info("没有浏览器,创建中。。。")
#
# fz_datas = get_group_lists()
#
# bit_id = createBrowser(
# name=self.x_info.user_name,
# groupId=fz_datas['推特'],
# host=self.ips_info.host,
# port=int(self.ips_info.port),
# proxyUserName=self.ips_info.username,
# proxyPassword=self.ips_info.password,
# )
#
# self.xstart_info.bit_id = bit_id
# self.xstart_info.save()
# self.get_page()
# if self.get_page():
# logger.info(f"推特名字:{self.x_info.user_name},浏览器打开成功")
# else:
# logger.error(f"推特名字:{self.x_info.user_name},浏览器打开失败")
# return
#
# time.sleep(5)
# for _, i in enumerate(self.page.get_tabs()):
# if _ == 0:
# continue
#
# i.close()
# self.get_name()
# if self.login_x_main():
# self.xstart_info.start = 1
# self.xstart_info.save()
#
# logger.success(f"推特名字:{self.x_info.user_name}登录x成功")
#
# # time.sleep(25)
# #
# # for i in self.x_tab.cookies():
# # if i["name"] == "auth_token":
# # self.xstart_info.cookie = i["value"]
# # self.xstart_info.save()
#
# else:
# logger.error(f"推特名字:{self.x_info.user_name}登录x失败")
# self.xstart_info.start = 0
# self.xstart_info.save()
# # 发推
# try:
# # self.x_tab.get("https://x.com/home")
# time.sleep(random.randint(3, 15))
#
# text = "Websea顶级渠道注册就可享受websea合约85%返佣,量大可谈,欢迎代理咨询。 TG飞机http://t.me/webseadds"
#
# self.x_tab.actions.click(
# 'x://*[@id="react-root"]/div/div/div[2]/main/div/div/div/div/div/div[3]/div/div[2]/div[1]/div/div/div/div[2]/div[1]/div/div/div/div/div/div/div/div/div/div/div/div[1]/div/div/div/div/div/div[2]/div/div/div/div').input(
# text)
#
# time.sleep(random.randint(3, 15))
# self.x_tab.actions.click(
# on_ele='x://*[@id="react-root"]/div/div/div[2]/main/div/div/div/div/div/div[3]/div/div[2]/div[1]/div/div/div/div[2]/div[2]/div[2]/div/div/div/button')
# time.sleep(5)
# except:
# pass
# # 获取推文链接
# self.get_urls()
# # 浏览推文
# try:
# self.to_li()
# except:
# pass
# # 养号流程
# try:
# self.account_nurturing()
# except Exception as e:
# print(e)
# 点击关注
# tab = self.page.new_tab(url="https://x.com/CryptoStart_App")
# time.sleep(10)
# ele = tab.ele('x://span[text()="Follow"]', timeout=0.5)
# if ele:
# tab.actions.click(on_ele=ele)
# time.sleep(10)
#
# for i in range(random.randint(1, 10)):
# tab.actions.scroll(delta_y=random.randint(400, 800))
# time.sleep(random.randint(3, 10))
# self.page.quit()
2025-11-19 15:15:50 +08:00
2025-12-08 16:38:40 +08:00
def run_work(x_token_info, xstart_info):
# hun_web = Hub_Web(x_info=x_token_info, xstart_info=xstart_info)
# executor.submit(hun_web.to_do_tui)
2026-01-15 15:06:37 +08:00
with Hub_Web(x_info=None, xstart_info=xstart_info) as hub:
2025-12-18 11:34:19 +08:00
try:
hub.account_nurturing() # 养号
except:
pass
2025-12-10 16:51:41 +08:00
2025-12-18 09:45:07 +08:00
# hub.to_do_tui() # 发推
2026-01-15 12:31:45 +08:00
hub.回复() # 发推
2025-12-10 18:33:22 +08:00
2026-01-15 12:31:45 +08:00
# hub.FollowTwitterAccount() # 关注
2025-12-08 16:38:40 +08:00
2025-11-19 15:15:50 +08:00
if __name__ == '__main__':
2026-01-15 15:06:37 +08:00
# ensure_tables()
# sync_xstart_from_bitbrowser(group_name="推特", max_pages=10)
#
# fz_datas = get_group_lists()
#
# for bit_data in get_browser_lists_Browser(id=fz_datas['推特']):
# print(bit_data)
# xstart_info, start = Xstart.get_or_create(
# bit_id=bit_data["id"],
# )
# if xstart_info.x_id:
# # continue
#
# hun_web = Hub_Web(xstart_info=xstart_info)
#
# # hun_web.action()
#
# threading.Thread(target=hun_web.action).start()
# time.sleep(random.randint(15, 60))
2026-01-15 13:43:12 +08:00
2026-01-15 15:06:37 +08:00
# 同时运行
max_threads = 5
delay_between_start = 30 # 每次启动线程之间的延迟时间(秒)
2025-11-28 18:22:38 +08:00
2026-01-15 15:06:37 +08:00
with ThreadPoolExecutor(max_workers=max_threads) as executor:
2025-12-01 14:14:17 +08:00
2026-01-15 15:06:37 +08:00
# for x_token_info in XToken.select():
2025-11-28 18:22:38 +08:00
2026-01-15 15:06:37 +08:00
# 查询数据并转换为列表
random_x_infos = list(Xstart.select())
# 直接对原列表进行打乱操作
random.shuffle(random_x_infos)
2025-12-08 16:07:14 +08:00
2026-01-15 15:06:37 +08:00
# 遍历打乱顺序后的列表
for x_token_info in random_x_infos:
2025-12-08 16:07:14 +08:00
2026-01-15 15:06:37 +08:00
# if xstart_info.start:
# continue
executor.submit(run_work, x_token_info, x_token_info)
# time.sleep(random.randint(60, 150))
time.sleep(delay_between_start)