Update screenshot_downloader.py - #2138
Conversation
Fixes bug where the application always fails on the skipping translation step and fails to take screenshots
Edit: sometimes the app will throw an error about waiting for the h1 slot="title" locator I believe this is to do with anti bot measures and I can usually fix it with a vpn. Edit to this comment: As a matter of fact every error received while using this script can be fixed by refreshing your vpn (obviously reddit doesn't like bots ;) ) |
JasonLovesDoggo
commented
Sep 18, 2024
I'll try to test it soon, looks good to me though |
JasonLovesDoggo
commented
Sep 23, 2024
It does not. ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Sorry, somethingwentwrongwiththisversion! Tryagain, andfeelfreetoreportthisissueatGitHubortheDiscordcommunity. │
│ Version: 3.3.0 │
│ Error: Locator.bounding_box: Timeout30000msexceeded. │
│ Calllog: │
│ waitingforlocator("[data-test-id=\"post-content\"]") │
│ │
│ Config: {'allow_nsfw': False, 'theme': 'transparent', 'times_to_run': 10, 'opacity': 0.5, 'storymode': False, 'storymodemethod': 0, 'storymode_max_length': 5000, 'resolution_w': 1080, 'resolution_h': 1920, 'zoom': 0.7, │
│ 'channel_name': 'Reddit Tales', 'background': {'background_video': 'minecraft', 'background_audio': '', 'background_audio_volume': 0.0, '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': 'streamlabspolly', 'tiktok_voice': 'en_us_001', 'tiktok_sessionid': 'REDACTED', 'python_voice': '1', │
│ 'py_voice_num': '2', 'silence_duration': 0.6, 'no_emojis': False, 'random_voice': False, 'elevenlabs_voice_name': 'Bella', 'elevenlabs_api_key': 'REDACTED', 'aws_polly_voice': '', 'streamlabs_polly_voice': 'Matthew'}} │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Traceback (mostrecentcalllast):
File"/home/lain/RedditVideoMakerBot/main.py", line131, in<module>raiseerrFile"/home/lain/RedditVideoMakerBot/main.py", line113, in<module>run_many(config["settings"]["times_to_run"])
File"/home/lain/RedditVideoMakerBot/main.py", line68, inrun_manymain()
File"/home/lain/RedditVideoMakerBot/main.py", line52, inmainget_screenshots_of_reddit_posts(reddit_object, number_of_comments)
File"/home/lain/RedditVideoMakerBot/video_creation/screenshot_downloader.py", line203, inget_screenshots_of_reddit_postsraiseeFile"/home/lain/RedditVideoMakerBot/video_creation/screenshot_downloader.py", line180, inget_screenshots_of_reddit_postslocation=page.locator('[data-test-id="post-content"]').bounding_box()
File"/home/lain/RedditVideoMakerBot/.venv/lib/python3.10/site-packages/playwright/sync_api/_generated.py", line14782, inbounding_boxself._sync(self._impl_obj.bounding_box(timeout=timeout))
File"/home/lain/RedditVideoMakerBot/.venv/lib/python3.10/site-packages/playwright/_impl/_sync_base.py", line115, in_syncreturntask.result()
File"/home/lain/RedditVideoMakerBot/.venv/lib/python3.10/site-packages/playwright/_impl/_locator.py", line127, inbounding_boxreturnawaitself._with_element(
File"/home/lain/RedditVideoMakerBot/.venv/lib/python3.10/site-packages/playwright/_impl/_locator.py", line108, in_with_elementhandle=awaitself.element_handle(timeout=timeout)
File"/home/lain/RedditVideoMakerBot/.venv/lib/python3.10/site-packages/playwright/_impl/_locator.py", line311, inelement_handlehandle=awaitself._frame.wait_for_selector(
File"/home/lain/RedditVideoMakerBot/.venv/lib/python3.10/site-packages/playwright/_impl/_frame.py", line323, inwait_for_selectorawaitself._channel.send("waitForSelector", locals_to_params(locals()))
File"/home/lain/RedditVideoMakerBot/.venv/lib/python3.10/site-packages/playwright/_impl/_connection.py", line59, insendreturnawaitself._connection.wrap_api_call(
File"/home/lain/RedditVideoMakerBot/.venv/lib/python3.10/site-packages/playwright/_impl/_connection.py", line514, inwrap_api_callraiserewrite_error(error, f"{parsed_st['apiName']}: {error}") fromNoneplaywright._impl._errors.TimeoutError: Locator.bounding_box: Timeout30000msexceeded.
Calllog:
waitingforlocator("[data-test-id=\"post-content\"]")
|
tahatsahin
commented
Sep 23, 2024
This works for me for some of the subreddits. Most of them still crashes. Reddit has updated its dom structure, i think that is the main reason why script fails. |
This needs to use asyncpraw for getting comments and titles. It will always fail / be a headache to fix otherwise. Using async praw would also remove the need for a headless browser driver. |
Teknoist
commented
Oct 13, 2024
ı try on windows stuck %67 and give me same log |
Dlunhappy226
commented
Oct 28, 2024
This don't work in zoom mode. |
Roostydoo2
commented
Nov 4, 2024
Hi all I have been made aware of some bugs with zoom I'll update my pull request soon to fix these as it's a pretty simple fix |
Fixes unable to zoom bug


Fixes bug where the application always fails on the skipping translation step and fails to take screenshots
Description
Solves the bug in which the application fails to take screenshots and outputs an error message on the skipping translation step.
Dependencies:
None
Issue Fixes
Solves the screenshot bug
Checklist:
Any other information (e.g how to test the changes)
Test with different settings if you want, in my experience it has never failed though (Not all code is perfect I'm not saying mine is).