Spaces:
Paused
Paused
Update script.py
Browse files
script.py
CHANGED
|
@@ -1,16 +1,25 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
|
| 3 |
-
def run(playwright):
|
| 4 |
firefox = playwright.firefox
|
| 5 |
-
browser = firefox.launch(headless=True)
|
| 6 |
-
context = browser.new_context()
|
| 7 |
-
page = context.new_page()
|
| 8 |
-
|
| 9 |
-
page.goto('https://d000d.com/e/9b3w45p3h2gz')
|
| 10 |
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
|
| 13 |
-
browser.close()
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
|
|
|
| 1 |
+
import asyncio
|
| 2 |
+
from playwright.async_api import async_playwright
|
| 3 |
|
| 4 |
+
async def run(playwright):
|
| 5 |
firefox = playwright.firefox
|
| 6 |
+
browser = await firefox.launch(headless=True)
|
| 7 |
+
context = await browser.new_context()
|
| 8 |
+
page = await context.new_page()
|
| 9 |
+
|
| 10 |
+
await page.goto('https://d000d.com/e/9b3w45p3h2gz')
|
| 11 |
|
| 12 |
+
# Wait for 5 seconds
|
| 13 |
+
await asyncio.sleep(5)
|
| 14 |
+
|
| 15 |
+
# Get and print the HTML of the page
|
| 16 |
+
print(await page.content())
|
| 17 |
|
| 18 |
+
await browser.close()
|
| 19 |
+
|
| 20 |
+
async def main():
|
| 21 |
+
async with async_playwright() as playwright:
|
| 22 |
+
await run(playwright)
|
| 23 |
|
| 24 |
+
# Run the function
|
| 25 |
+
asyncio.run(main())
|