Skip to content

Commit 690b0b6

Browse files
committed
Change example to duckduckgo
1 parent 0a0e7f9 commit 690b0b6

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

examples/wait_for_entire_page_load/wait_for_entire_page_load.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
from playwright.sync_api import sync_playwright
55

66
# Yotube video URL to demonstrate the example for loading comments on the video
7-
URL = "https://www.youtube.com/watch?v=F6hmwkI3n64"
7+
URL = "https://duckduckgo.com/?q=machine+learning+lectures+mit&t=h_&iar=videos&iax=videos&ia=videos"
88

99
QUERY = """
1010
{
11-
comments[] {
12-
comment_content
13-
author
14-
date
11+
videos(first 10 videos)[] {
12+
video_title
13+
length
14+
views
1515
}
1616
}
1717
"""
@@ -25,16 +25,16 @@ def main():
2525
page: Page = browser.new_page()
2626
page.goto(URL)
2727

28-
for _ in range(3):
29-
# Wait for the page to load (helps to load the comments on the video)
28+
for _ in range(2):
29+
# Wait for the page to load (helps to load the additional videos)
3030
page.wait_for_page_ready_state()
31-
# Scroll down the page to trigger loading of comments
32-
page.keyboard.press("PageDown")
31+
# Scroll down the page to trigger loading of more videos
32+
page.keyboard.press("End")
3333

3434
response = page.query_data(QUERY)
3535

36-
# Print the first comment
37-
print(response["comments"][0])
36+
# Print the first video details
37+
print(response["videos"][0])
3838

3939
browser.close()
4040

0 commit comments

Comments
 (0)