-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update screenshot_downloader.py #2138
base: develop
Are you sure you want to change the base?
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 ;) ) |
I'll try to test it soon, looks good to me though |
It does not. ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ 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.bounding_box: Timeout 30000ms exceeded. │
│ Call log: │
│ waiting for locator("[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 (most recent call last):
File "/home/lain/RedditVideoMakerBot/main.py", line 131, in <module>
raise err
File "/home/lain/RedditVideoMakerBot/main.py", line 113, in <module>
run_many(config["settings"]["times_to_run"])
File "/home/lain/RedditVideoMakerBot/main.py", line 68, in run_many
main()
File "/home/lain/RedditVideoMakerBot/main.py", line 52, in main
get_screenshots_of_reddit_posts(reddit_object, number_of_comments)
File "/home/lain/RedditVideoMakerBot/video_creation/screenshot_downloader.py", line 203, in get_screenshots_of_reddit_posts
raise e
File "/home/lain/RedditVideoMakerBot/video_creation/screenshot_downloader.py", line 180, in get_screenshots_of_reddit_posts
location = page.locator('[data-test-id="post-content"]').bounding_box()
File "/home/lain/RedditVideoMakerBot/.venv/lib/python3.10/site-packages/playwright/sync_api/_generated.py", line 14782, in bounding_box
self._sync(self._impl_obj.bounding_box(timeout=timeout))
File "/home/lain/RedditVideoMakerBot/.venv/lib/python3.10/site-packages/playwright/_impl/_sync_base.py", line 115, in _sync
return task.result()
File "/home/lain/RedditVideoMakerBot/.venv/lib/python3.10/site-packages/playwright/_impl/_locator.py", line 127, in bounding_box
return await self._with_element(
File "/home/lain/RedditVideoMakerBot/.venv/lib/python3.10/site-packages/playwright/_impl/_locator.py", line 108, in _with_element
handle = await self.element_handle(timeout=timeout)
File "/home/lain/RedditVideoMakerBot/.venv/lib/python3.10/site-packages/playwright/_impl/_locator.py", line 311, in element_handle
handle = await self._frame.wait_for_selector(
File "/home/lain/RedditVideoMakerBot/.venv/lib/python3.10/site-packages/playwright/_impl/_frame.py", line 323, in wait_for_selector
await self._channel.send("waitForSelector", locals_to_params(locals()))
File "/home/lain/RedditVideoMakerBot/.venv/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 59, in send
return await self._connection.wrap_api_call(
File "/home/lain/RedditVideoMakerBot/.venv/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 514, in wrap_api_call
raise rewrite_error(error, f"{parsed_st['apiName']}: {error}") from None
playwright._impl._errors.TimeoutError: Locator.bounding_box: Timeout 30000ms exceeded.
Call log:
waiting for locator("[data-test-id=\"post-content\"]")
|
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. |
ı try on windows stuck %67 and give me same log |
This don't work in zoom mode. |
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).