This commit is contained in:
zjf 2025-05-29 16:48:02 +08:00
parent 6cdcf154a7
commit bdf5e94dce
1 changed files with 7 additions and 7 deletions

View File

@ -538,8 +538,8 @@ with (rpa_image.imports()):
await context.add_cookies(cookies) await context.add_cookies(cookies)
logger.info("Loaded cookies") logger.info("Loaded cookies")
page: Page = await context.new_page() page: Page = await context.new_page()
# url = f"https://live.douyin.com/{webcast_id}?open_promotion_list=1&from_search=true" url = f"https://live.douyin.com/{webcast_id}?open_promotion_list=1&from_search=true"
url = f"https://live.douyin.com/{webcast_id}" # url = f"https://live.douyin.com/{webcast_id}"
logger.info(f"Navigating to {url}") logger.info(f"Navigating to {url}")
await page.goto(url, wait_until="domcontentloaded") await page.goto(url, wait_until="domcontentloaded")
logger.info(f"Navigating to end {url}") logger.info(f"Navigating to end {url}")
@ -547,9 +547,9 @@ with (rpa_image.imports()):
result.title = await page.title() result.title = await page.title()
logger.info(f"------Retrieved title: {result.title}") logger.info(f"------Retrieved title: {result.title}")
await page.get_by_text("全部商品").click() # await page.get_by_text("全部商品").click()
print("已点击 全部商品 ") # print("已点击 全部商品 ")
await page.wait_for_timeout(3 * 1000) # await page.wait_for_timeout(3 * 1000)
live_status = await get_live_status_by_web_page(page, webcast_id) live_status = await get_live_status_by_web_page(page, webcast_id)
@ -570,7 +570,7 @@ with (rpa_image.imports()):
@retry(stop=stop_after_attempt(50), wait=wait_fixed(5)) @retry(stop=stop_after_attempt(50), wait=wait_fixed(5))
async def wait_for_load_state_foo(page: Page, url): async def wait_for_load_state_foo(page: Page, url):
logger.info(f"networkidle to start {url}") logger.info(f"networkidle to start {url}")
await page.wait_for_load_state(state="load") await page.wait_for_load_state(state="networkidle")
logger.info(f"networkidle to end {url}") logger.info(f"networkidle to end {url}")
pass pass
@ -582,7 +582,7 @@ with (rpa_image.imports()):
# 312898731614 # 312898731614
# webcast_ids = ["36861064178"] # webcast_ids = ["36861064178"]
# webcast_ids = ["36861064178"] # webcast_ids = ["36861064178"]
webcast_id = "837842834415" webcast_id = "65731953339"
data: LiveStreamProductWatchRequest = LiveStreamProductWatchRequest(live_id=webcast_id, data: LiveStreamProductWatchRequest = LiveStreamProductWatchRequest(live_id=webcast_id,
live_stream_name=str(ULID())) live_stream_name=str(ULID()))