From 77c43d4ac841cdc0c6f9416447715b5c264cf703 Mon Sep 17 00:00:00 2001 From: RogerWork Date: Sat, 1 Feb 2025 07:13:53 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E7=94=A8=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jd_playwright.py | 24 +++++++++++++++++++----- jd_uia.py | 11 +++++++---- main_uia.py | 28 ++++++++++++++++------------ test.py | 10 ++++++++++ 4 files changed, 52 insertions(+), 21 deletions(-) create mode 100644 test.py diff --git a/jd_playwright.py b/jd_playwright.py index 3882da2..f69a804 100644 --- a/jd_playwright.py +++ b/jd_playwright.py @@ -1,9 +1,23 @@ import re from playwright.sync_api import Playwright, sync_playwright, expect -import time +import time, datetime from get_jd_timestamp import jd_timer -target: str = '2025-01-21 15:41:00' + +def get_firday(): + today = datetime.datetime.strptime(datetime.datetime.strftime(datetime.date.today(), '%Y-%m-%d') + ' 20:00:00', '%Y-%m-%d %H:%M:%S') + friday = today + datetime.timedelta( days=(4-today.weekday())%7) + print(friday) + return datetime.datetime.strftime(friday, '%Y-%m-%d %H:%M:%S') + + +# 需要每次定义 +target: str = get_firday() + +# 19920002680 +# user = {'mobile': '19920002680', 'password': 'Sxzgx1209'} +# 18611659484 +user = {'mobile': '18611659484', 'password': 'Rog129Sunx1532'} target_timestamp = int(time.mktime(time.strptime(target, '%Y-%m-%d %H:%M:%S'))*1000) AC_URL = f"https://h5static.m.jd.com/mall/active/xXzWGzxuJ6HRksjXms2x3cQsh25/index.html?utm_term=Wxfriends&utm_user=plusmember&utm_source=iosapp&utm_campaign=t_335139774&utm_medium=appshare&_ts={str(target_timestamp)}&ad_od=share&gxd=RnAowmYKPGXfnp4Sq4B_W578vOMp4E7JgUugKDcomXTOIlSPI-BCnvuytD0G7kc&gx=RnAomDgLPTTeyp5Z_sA9" @@ -16,13 +30,13 @@ def run(playwright: Playwright) -> None: page.goto("https://www.jd.com/") page.get_by_role("link", name="你好,请登录").click() page.get_by_placeholder("账号名/手机号/邮箱").click() - page.get_by_placeholder("账号名/手机号/邮箱").fill("18611659484") - page.get_by_placeholder("密码").fill("Rog129Sunx1532") + page.get_by_placeholder("账号名/手机号/邮箱").fill(user['mobile']) # 19920002680 18611659484 + page.get_by_placeholder("密码").fill(user['password']) page.get_by_role("link", name="登    录").click() time.sleep(30) - if page.get_by_text("hehedehehe"): + if page.get_by_text("切换账号"): # 打开活动页面 print('登录成功!') print(AC_URL) diff --git a/jd_uia.py b/jd_uia.py index 7acffdf..5c0faf8 100644 --- a/jd_uia.py +++ b/jd_uia.py @@ -38,11 +38,14 @@ class JdClient: self.dev.implicitly_wait(1) # print('等待1秒') - while True: - if self.dev(text='为好友助力').exists: - print(self.device, '为好友助力') + self.dev.implicitly_wait(2) + self.dev.click(531, 1323) + while True: #531,1323 + if self.dev(text='成功邀请10人助力赢好礼').exists: + print(self.device, '成功邀请10人助力赢好礼') self.dev.implicitly_wait(1) - self.dev(text='为好友助力').click() + # self.dev(text='为好友助力').click() + self.dev.click(531, 1323) break else: self.dev.implicitly_wait(1) diff --git a/main_uia.py b/main_uia.py index 3282aef..b5fd184 100644 --- a/main_uia.py +++ b/main_uia.py @@ -5,20 +5,24 @@ import multiprocessing, threading # device_list = ['127.0.0.1:16416', # '127.0.0.1:16448'] -device_list = device_list = [ - '127.0.0.1:16416', - '127.0.0.1:16448', - '127.0.0.1:16480', - '127.0.0.1:16512', - # '127.0.0.1:16544', - # '127.0.0.1:16576', - '127.0.0.1:16608', - # '127.0.0.1:16640', - # '127.0.0.1:16672', - # '127.0.0.1:16704', - # 'b189a9ab', # 一加 +# NUC14 +device_list = [ + '127.0.0.1:16416', # 1 + '127.0.0.1:16448', # 2 + '127.0.0.1:16480', # 3 + '127.0.0.1:16512', # 4 + '127.0.0.1:16608', # 7 ] +# HomeServer +# device_list = [ +# '127.0.0.1:16384', +# '127.0.0.1:16416', +# '127.0.0.1:16448', +# '127.0.0.1:16480', +# '127.0.0.1:16512', +# ] + # listen_list = ['Honey', '分身199'] listen_list = ['Honey'] diff --git a/test.py b/test.py new file mode 100644 index 0000000..1db254e --- /dev/null +++ b/test.py @@ -0,0 +1,10 @@ +import datetime + +def get_firday(): + today = datetime.datetime.strptime(datetime.datetime.strftime(datetime.date.today(), '%Y-%m-%d') + ' 20:00:00', '%Y-%m-%d %H:%M:%S') + print(today) + friday = today + datetime.timedelta( days=(4-today.weekday())%7) + return friday + +if __name__ == '__main__': + print(get_firday()) \ No newline at end of file