Spaces:
Running
Running
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) |