|
|
@ -1,4 +1,4 @@
|
|
|
|
from playwright.sync_api import sync_playwright
|
|
|
|
from playwright.sync_api import sync_playwright, ViewportSize
|
|
|
|
from pathlib import Path
|
|
|
|
from pathlib import Path
|
|
|
|
from rich.progress import track
|
|
|
|
from rich.progress import track
|
|
|
|
from utils.console import print_step, print_substep
|
|
|
|
from utils.console import print_step, print_substep
|
|
|
@ -31,7 +31,7 @@ def download_screenshots_of_reddit_posts(reddit_object, screenshot_num, theme):
|
|
|
|
# Get the thread screenshot
|
|
|
|
# Get the thread screenshot
|
|
|
|
page = context.new_page()
|
|
|
|
page = context.new_page()
|
|
|
|
page.goto(reddit_object["thread_url"])
|
|
|
|
page.goto(reddit_object["thread_url"])
|
|
|
|
|
|
|
|
page.set_viewport_size(ViewportSize(width=1920, height=1080))
|
|
|
|
if page.locator('[data-testid="content-gate"]').is_visible():
|
|
|
|
if page.locator('[data-testid="content-gate"]').is_visible():
|
|
|
|
# This means the post is NSFW and requires to click the proceed button.
|
|
|
|
# This means the post is NSFW and requires to click the proceed button.
|
|
|
|
|
|
|
|
|
|
|
@ -57,4 +57,6 @@ def download_screenshots_of_reddit_posts(reddit_object, screenshot_num, theme):
|
|
|
|
page.locator(f"#t1_{comment['comment_id']}").screenshot(
|
|
|
|
page.locator(f"#t1_{comment['comment_id']}").screenshot(
|
|
|
|
path=f"assets/png/comment_{idx}.png"
|
|
|
|
path=f"assets/png/comment_{idx}.png"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
print_substep("Screenshots downloaded successfully.", style="bold green")
|
|
|
|
|
|
|
|
|
|
|
|
print_substep("Screenshots downloaded Successfully.",
|
|
|
|
|
|
|
|
style="bold green")
|
|
|
|