Skip to content

Commit

Permalink
fix(praw): Bypass reddit bot detection
Browse files Browse the repository at this point in the history
fixes: #2228
Signed-off-by: Jason Cameron <[email protected]>
  • Loading branch information
JasonLovesDoggo committed Jan 29, 2025
1 parent b573c50 commit 392b8ae
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions video_creation/screenshot_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,12 @@ def get_screenshots_of_reddit_posts(reddit_object: dict, screenshot_num: int):
dsf = (W // 600) + 1

context = browser.new_context(
locale=lang or "en-us",
locale=lang or "en-CA,en;q=0.9",
color_scheme="dark",
viewport=ViewportSize(width=W, height=H),
device_scale_factor=dsf,
user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36",
extra_http_headers={"Dnt": "1", "Sec-Ch-Ua": '"Not A(Brand";v="8", "Chromium";v="132", "Google Chrome";v="132"' },
)
cookies = json.load(cookie_file)
cookie_file.close()
Expand Down

2 comments on commit 392b8ae

@domiweb
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, for me this doesn't fix the issue #2228

@adityasurendran
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the fix does not work, ive impleneted it, but this is the log

Sorry, something went wrong with this version! Try again, and feel free to report this issue at GitHub or the
│ Discord community.
│ Version: 3.3.0
│ Error: Locator.screenshot: Timeout 30000ms exceeded.
│ Call log:
│ waiting for locator("[data-test-id="post-content"]")

│ Config: {'allow_nsfw': False, 'theme': 'light', 'times_to_run': 1, 'opacity': 0.9, 'storymode': False,
│ 'storymodemethod': 1, 'storymode_max_length': 1000, 'resolution_w': 1080, 'resolution_h': 1920, 'zoom': 1.0,
│ 'channel_name': 'DevDesk', 'background': {'background_video': 'minecraft', 'background_audio': 'lofi',
│ 'background_audio_volume': 0.15, 'enable_extra_audio': False, 'background_thumbnail': False,
│ 'background_thumbnail_font_family': 'arial', 'background_thumbnail_font_size': 96,
│ 'background_thumbnail_font_color': '255,255,255'}, 'tts': {'voice_choice': 'pyttsx', 'random_voice': True,
│ 'elevenlabs_voice_name': 'Bella', 'elevenlabs_api_key': 'REDACTED', 'aws_polly_voice': 'Matthew',
│ 'streamlabs_polly_voice': 'Matthew', 'tiktok_voice': 'en_us_001', 'tiktok_sessionid': 'REDACTED', 'python_voice':
│ '1', 'py_voice_num': '2', 'silence_duration': 0.3, 'no_emojis': False}

#2228

Please sign in to comment.