|
|
|
@ -3,6 +3,7 @@ from pathlib import Path
|
|
|
|
|
|
|
|
|
|
from playwright.sync_api import sync_playwright, ViewportSize
|
|
|
|
|
from rich.progress import track
|
|
|
|
|
from rich.console import Console
|
|
|
|
|
|
|
|
|
|
from utils.console import print_step, print_substep
|
|
|
|
|
|
|
|
|
@ -14,12 +15,14 @@ def download_screenshots_of_reddit_posts(reddit_object, screenshot_num, theme):
|
|
|
|
|
reddit_object: The Reddit Object you received in askreddit.py
|
|
|
|
|
screenshot_num: The number of screenshots you want to download.
|
|
|
|
|
"""
|
|
|
|
|
console = Console()
|
|
|
|
|
|
|
|
|
|
print_step("Downloading Screenshots of Reddit Posts 📷")
|
|
|
|
|
|
|
|
|
|
# ! Make sure the reddit screenshots folder exists
|
|
|
|
|
Path("assets/png").mkdir(parents=True, exist_ok=True)
|
|
|
|
|
|
|
|
|
|
print_substep("Launching Headless Browser...")
|
|
|
|
|
with console.status("[bold]Launching Headless Browser ...", spinner="simpleDots"):
|
|
|
|
|
with sync_playwright() as browser_:
|
|
|
|
|
browser = browser_.chromium.launch()
|
|
|
|
|
context = browser.new_context()
|
|
|
|
|