1 parent
10f87c34c1
commit
f8c340f612
3 files changed
+16
-1
No files matched your search
@@ -5,3 +5,4 @@ REDDIT_PASSWORD=""
|
||||
SUBREDDIT="AskReddit"
|
||||
ALLOW_NSFW="False"
|
||||
POST_ID=""
|
||||
THEME="LIGHT"
|
||||
@@ -0,0 +1,8 @@
|
||||
[
|
||||
{
|
||||
"name": "USER",
|
||||
"value": "eyJwcmVmcyI6eyJ0b3BDb250ZW50RGlzbWlzc2FsVGltZSI6MCwiZ2xvYmFsVGhlbWUiOiJSRURESVQiLCJuaWdodG1vZGUiOnRydWUsImNvbGxhcHNlZFRyYXlTZWN0aW9ucyI6eyJmYXZvcml0ZXMiOmZhbHNlLCJtdWx0aXMiOmZhbHNlLCJtb2RlcmF0aW5nIjpmYWxzZSwic3Vic2NyaXB0aW9ucyI6ZmFsc2UsInByb2ZpbGVzIjpmYWxzZX0sInRvcENvbnRlbnRUaW1lc0Rpc21pc3NlZCI6MH19",
|
||||
"domain": ".reddit.com",
|
||||
"path": "/"
|
||||
}
|
||||
]
|
||||
@@ -1,3 +1,4 @@
|
||||
import json
|
||||
from os import getenv
|
||||
|
||||
from playwright.sync_api import sync_playwright
|
||||
@@ -22,9 +23,14 @@ def download_screenshots_of_reddit_posts(reddit_object, screenshot_num):
|
||||
print_substep("Launching Headless Browser...")
|
||||
|
||||
browser = p.chromium.launch()
|
||||
context = browser.new_context()
|
||||
|
||||
if getenv("THEME").upper() == "DARK":
|
||||
cookie_file = open('./video_creation/data/cookie.json')
|
||||
cookies = json.load(cookie_file)
|
||||
context.add_cookies(cookies)
|
||||
# Get the thread screenshot
|
||||
page = browser.new_page()
|
||||
page = context.new_page()
|
||||
page.goto(reddit_object["thread_url"])
|
||||
|
||||
if page.locator('[data-testid="content-gate"]').is_visible():
|
||||
|
||||
Reference in new issue
Block a user