|
|
@ -1,9 +1,23 @@ |
|
|
|
import re |
|
|
|
import re |
|
|
|
from playwright.sync_api import Playwright, sync_playwright, expect |
|
|
|
from playwright.sync_api import Playwright, sync_playwright, expect |
|
|
|
import time |
|
|
|
import time, datetime |
|
|
|
from get_jd_timestamp import jd_timer |
|
|
|
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) |
|
|
|
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" |
|
|
|
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.goto("https://www.jd.com/") |
|
|
|
page.get_by_role("link", name="你好,请登录").click() |
|
|
|
page.get_by_role("link", name="你好,请登录").click() |
|
|
|
page.get_by_placeholder("账号名/手机号/邮箱").click() |
|
|
|
page.get_by_placeholder("账号名/手机号/邮箱").click() |
|
|
|
page.get_by_placeholder("账号名/手机号/邮箱").fill("18611659484") |
|
|
|
page.get_by_placeholder("账号名/手机号/邮箱").fill(user['mobile']) # 19920002680 18611659484 |
|
|
|
page.get_by_placeholder("密码").fill("Rog129Sunx1532") |
|
|
|
page.get_by_placeholder("密码").fill(user['password']) |
|
|
|
page.get_by_role("link", name="登 录").click() |
|
|
|
page.get_by_role("link", name="登 录").click() |
|
|
|
|
|
|
|
|
|
|
|
time.sleep(30) |
|
|
|
time.sleep(30) |
|
|
|
|
|
|
|
|
|
|
|
if page.get_by_text("hehedehehe"): |
|
|
|
if page.get_by_text("切换账号"): |
|
|
|
# 打开活动页面 |
|
|
|
# 打开活动页面 |
|
|
|
print('登录成功!') |
|
|
|
print('登录成功!') |
|
|
|
print(AC_URL) |
|
|
|
print(AC_URL) |
|
|
|