rgfewfger
This commit is contained in:
128
推特/main.py
128
推特/main.py
@@ -331,6 +331,78 @@ class Hub_Web:
|
||||
'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')
|
||||
time.sleep(random.randint(1, 10))
|
||||
|
||||
def account_nurturing(self):
|
||||
self.page.get(url=f"https://x.com/search?q=websea&src=typed_query")
|
||||
|
||||
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))
|
||||
|
||||
def action(self):
|
||||
|
||||
self.ips_info = Ips.select().order_by(fn.Rand()).get()
|
||||
@@ -362,29 +434,29 @@ class Hub_Web:
|
||||
|
||||
# time.sleep(5)
|
||||
|
||||
for _, i in enumerate(self.page.get_tabs()):
|
||||
if _ == 0:
|
||||
continue
|
||||
|
||||
i.close()
|
||||
|
||||
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()
|
||||
# for _, i in enumerate(self.page.get_tabs()):
|
||||
# if _ == 0:
|
||||
# continue
|
||||
#
|
||||
# i.close()
|
||||
#
|
||||
# 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.soon_action()
|
||||
@@ -403,14 +475,20 @@ class Hub_Web:
|
||||
# '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').click()
|
||||
# time.sleep(5)
|
||||
|
||||
# # 获取推文链接
|
||||
# self.get_urls()
|
||||
#
|
||||
|
||||
# # 浏览推文
|
||||
# try:
|
||||
# self.to_li()
|
||||
# except:
|
||||
# pass
|
||||
|
||||
self.page.get(url=f"https://x.com/search?q=websea&src=typed_query")
|
||||
# 养号流程
|
||||
try:
|
||||
self.account_nurturing()
|
||||
except:
|
||||
pass
|
||||
|
||||
self.page.quit()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user