fwefwf
This commit is contained in:
26
bit_tools.py
26
bit_tools.py
@@ -154,16 +154,16 @@ def group_add(groupName):
|
||||
|
||||
return res.json()
|
||||
|
||||
# if __name__ == '__main__':
|
||||
# for i in Xstart.select().where(
|
||||
# Xstart.x_id.is_null()
|
||||
# ):
|
||||
# ips_info = Ips.select().where(Ips.start == 1).order_by(fn.Rand()).get()
|
||||
#
|
||||
# update_proxy_Browser(
|
||||
# id=i.bit_id,
|
||||
# host=ips_info.host,
|
||||
# port=ips_info.port,
|
||||
# proxyUserName=ips_info.username,
|
||||
# proxyPassword=ips_info.password
|
||||
# )
|
||||
if __name__ == '__main__':
|
||||
for i in Xstart.select().where(
|
||||
Xstart.x_id.is_null()
|
||||
):
|
||||
ips_info = Ips.select().where(Ips.start == 1,Ips.country == "法国").order_by(fn.Rand()).get()
|
||||
|
||||
update_proxy_Browser(
|
||||
id=i.bit_id,
|
||||
host=ips_info.host,
|
||||
port=ips_info.port,
|
||||
proxyUserName=ips_info.username,
|
||||
proxyPassword=ips_info.password
|
||||
)
|
||||
|
||||
@@ -10,6 +10,7 @@ class Ips(Model):
|
||||
username = CharField(null=True)
|
||||
password = CharField(null=True)
|
||||
start = IntegerField(null=True)
|
||||
country = CharField(null=True)
|
||||
|
||||
class Meta:
|
||||
database = db1
|
||||
|
||||
@@ -6,7 +6,7 @@ from models.ips import Ips
|
||||
|
||||
class Xstart(Model):
|
||||
id = AutoField(primary_key=True) # 自增主键
|
||||
bit_id = IntegerField(null=True)
|
||||
bit_id = CharField(null=True)
|
||||
start = IntegerField(null=True)
|
||||
x_id = IntegerField(null=True)
|
||||
ip_id = IntegerField(null=True)
|
||||
|
||||
80
推特/main.py
80
推特/main.py
@@ -1,10 +1,10 @@
|
||||
import time
|
||||
import pyotp
|
||||
import random
|
||||
import threading
|
||||
import time
|
||||
|
||||
from loguru import logger
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
import pyotp
|
||||
from DrissionPage import ChromiumOptions, ChromiumPage
|
||||
from loguru import logger
|
||||
from peewee import fn
|
||||
|
||||
from bit_tools import openBrowser, createBrowser, get_group_lists, get_browser_lists_Browser
|
||||
@@ -14,7 +14,7 @@ from models.xtoken import XToken
|
||||
|
||||
|
||||
class Hub_Web:
|
||||
def __init__(self, xstart_info, x_info):
|
||||
def __init__(self, xstart_info, x_info=None):
|
||||
self.xstart_info = xstart_info
|
||||
self.x_info = x_info
|
||||
|
||||
@@ -403,6 +403,31 @@ class Hub_Web:
|
||||
time.sleep(random.randint(1, 10))
|
||||
self.page.scroll(random.randint(500, 1000))
|
||||
|
||||
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
|
||||
|
||||
def action(self):
|
||||
|
||||
self.ips_info = Ips.select().order_by(fn.Rand()).get()
|
||||
@@ -426,11 +451,13 @@ class Hub_Web:
|
||||
self.xstart_info.bit_id = bit_id
|
||||
self.xstart_info.save()
|
||||
|
||||
if self.get_page():
|
||||
logger.info(f"推特名字:{self.x_info.user_name},浏览器打开成功")
|
||||
else:
|
||||
logger.error(f"推特名字:{self.x_info.user_name},浏览器打开失败")
|
||||
return
|
||||
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)
|
||||
|
||||
@@ -440,6 +467,8 @@ class Hub_Web:
|
||||
|
||||
i.close()
|
||||
|
||||
self.get_name()
|
||||
|
||||
# if self.login_x_main():
|
||||
# self.xstart_info.start = 1
|
||||
# self.xstart_info.save()
|
||||
@@ -458,14 +487,6 @@ class Hub_Web:
|
||||
# self.xstart_info.start = 0
|
||||
# self.xstart_info.save()
|
||||
|
||||
# try:
|
||||
# self.soon_action()
|
||||
#
|
||||
# self.hub_web_info.soon_start = 1
|
||||
# self.hub_web_info.save()
|
||||
# except:
|
||||
# pass
|
||||
|
||||
# # 发推
|
||||
# self.x_tab.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[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(
|
||||
@@ -490,14 +511,33 @@ class Hub_Web:
|
||||
# except Exception as e:
|
||||
# print(e)
|
||||
|
||||
tab = self.page.new_tab(url="https://x.com/Websea_MY")
|
||||
time.sleep(10)
|
||||
ele = tab.ele('x://span[text()="Follow"]', timeout=0.5)
|
||||
if ele:
|
||||
tab.actions.click(on_ele=ele)
|
||||
time.sleep(10)
|
||||
|
||||
self.page.quit()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
fz_datas = get_group_lists()
|
||||
|
||||
for i in get_browser_lists_Browser(id=fz_datas['推特']):
|
||||
print(i)
|
||||
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(15)
|
||||
|
||||
# # 同时运行
|
||||
# max_threads = 1
|
||||
|
||||
Reference in New Issue
Block a user