try_docker_selinium / selimium_try.py
niharika17032001's picture
commmit Dockerfile
101de00
raw
history blame contribute delete
464 Bytes
from playwright.sync_api import sync_playwright
def get_youtube_html(url="https://www.youtube.com"):
"""Fetches the HTML content of a YouTube page using Playwright."""
with sync_playwright() as p:
browser = p.chromium.launch()
page = browser.new_page()
page.goto(url)
html = page.content()
browser.close()
return html
if __name__ == "__main__":
html_content = get_youtube_html()
print(html_content)