elebumm / RedditVideoMakerBot

Create Reddit Videos with just✨ one command ✨
GNU General Public License v3.0
6.6k stars 1.84k forks source link

[Bug]: waiting for locator("[data-test-id=\"post-content\"]") #2075

Closed OCEANOFANYTHINGOFFICIAL closed 1 month ago

OCEANOFANYTHINGOFFICIAL commented 3 months ago

Describe the bug

Using subreddit: r/ollama from TOML config This post has under the specified minimum of comments (2). Skipping... This post has under the specified minimum of comments (2). Skipping... This post has under the specified minimum of comments (2). Skipping... Video will be: Mixed GPU setups? πŸ‘ Thread url is: https://new.reddit.com//r/ollama/comments/1dltfmq/mixed_gpu_setups/ πŸ‘ Thread has 3 upvotes Thread has a upvote ratio of 100.0% Thread has 6 comments Received subreddit threads Successfully. Thread ID is 1dltfmq β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Saving Text to MP3 files... β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ Saving... ---------------------------------------- 0.2 it/s Saved Text to MP3 files successfully. β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ Downloading screenshots of reddit posts... β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ Launching Headless Browser... Logging in to Reddit... Skipping translation... Something went wrong! Something went wrong with making the screenshots! Do you want to skip the post? (y/n) y The post is successfully skipped! You can now restart the program and this post will skipped. Do you want the error traceback for debugging purposes? (y/n)y β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ 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': 'dark', 'times_to_run': 104, 'opacity': 1.0, 'storymode': False, 'storymodemethod': 1, 'storymode_max_length': 1000, β”‚ β”‚ 'resolution_w': 1080, 'resolution_h': 1920, 'zoom': 1.6, 'channel_name': 'OCEANOFANYTHING', 'background': {'background_video': 'orange-abstract', β”‚ β”‚ 'background_audio': 'lofi-rain', 'background_audio_volume': 0.7, 'enable_extra_audio': False, 'background_thumbnail': False, 'background_thumbnail_font_family': β”‚ β”‚ 'arial', 'background_thumbnail_font_size': 100, 'background_thumbnail_font_color': '255,255,255'}, 'tts': {'voice_choice': 'streamlabspolly', 'random_voice': True, β”‚ β”‚ 'elevenlabs_voice_name': 'Bella', 'elevenlabs_api_key': 'REDACTED', 'aws_polly_voice': 'Brian', 'streamlabs_polly_voice': 'Matthew', 'tiktok_voice': β”‚ β”‚ 'en_us_ghostface', 'tiktok_sessionid': 'REDACTED', 'python_voice': '1', 'py_voice_num': '2', 'silence_duration': 0.1, 'no_emojis': False}} β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ Traceback (most recent call last): File "D:\AI\RedditVideoMakerBot\main.py", line 130, in raise err File "D:\AI\RedditVideoMakerBot\main.py", line 112, in run_many(config["settings"]["times_to_run"]) File "D:\AI\RedditVideoMakerBot\main.py", line 67, in run_many main() File "D:\AI\RedditVideoMakerBot\main.py", line 51, in main get_screenshots_of_reddit_posts(reddit_object, number_of_comments) File "D:\AI\RedditVideoMakerBot\video_creation\screenshot_downloader.py", line 203, in get_screenshots_of_reddit_posts raise e File "D:\AI\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 "D:\AI\RedditVideoMakerBot\venv\lib\site-packages\playwright\sync_api_generated.py", line 14782, in bounding_box self._sync(self._impl_obj.bounding_box(timeout=timeout)) File "D:\AI\RedditVideoMakerBot\venv\lib\site-packages\playwright_impl_sync_base.py", line 115, in _sync return task.result() File "D:\AI\RedditVideoMakerBot\venv\lib\site-packages\playwright_impl_locator.py", line 127, in bounding_box return await self._with_element( File "D:\AI\RedditVideoMakerBot\venv\lib\site-packages\playwright_impl_locator.py", line 108, in _with_element handle = await self.element_handle(timeout=timeout) File "D:\AI\RedditVideoMakerBot\venv\lib\site-packages\playwright_impl_locator.py", line 311, in element_handle handle = await self._frame.wait_for_selector( File "D:\AI\RedditVideoMakerBot\venv\lib\site-packages\playwright_impl_frame.py", line 323, in wait_for_selector await self._channel.send("waitForSelector", locals_to_params(locals())) File "D:\AI\RedditVideoMakerBot\venv\lib\site-packages\playwright_impl_connection.py", line 59, in send return await self._connection.wrap_api_call( File "D:\AI\RedditVideoMakerBot\venv\lib\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\"]")

Reproduction Steps

I'm writing this on 23rd June. Yesterday it worked fine and I generated more than 50 videos from different subredits. but today when I started the bot, it kept giving me these errors. I tried to fix with the followings:

  1. Tried to use a different Reddit account and TikTok session id
  2. tried to reverse engineer the program, and found that reddit changed some layouts of their pages, that's why its quite challenging to get the screenshot. even I could not figured that out. reddit changed data-test-id to data-testid and post-content is not even found on the latest pages.
  3. tried to reinstall all dependencies
  4. tried to delete and recreate nenv
  5. upgraded moviepy
  6. reinstalled playwright

Appearently none of above worked, but I thing I figured out the problem(with the new HTML layout of their page" I appreciate a quick fix for this, cuz my yt channel is based on this topic, if it is not fixed I cant make any video, please do fix it, a kind request to @elebumm , I'm a big sub of your yt channel, please fix it man if you get any free time on you πŸ™

Expected behavior

Expected to run the program without any issue

Screenshots

Here Are The Screenshots: rd-2 rd-1

System Information

Operating System : Windows 10 Python version : 3.10 App version : 3.3.0

Checklist

Additional Context

No response

aarora4 commented 3 months ago

Have the same issue. I fixed this by changing line 180 in screenshot_downloader.py to

location = page.locator('[data-testid="post-container"] [data-test-id="post-content"]').bounding_box()

OCEANOFANYTHINGOFFICIAL commented 3 months ago

Have the same issue. I fixed this by changing line 180 in screenshot_downloader.py to

location = page.locator('[data-testid="post-container"] [data-test-id="post-content"]').bounding_box()

thanks man! I'll try this up

OCEANOFANYTHINGOFFICIAL commented 3 months ago

Have the same issue. I fixed this by changing line 180 in screenshot_downloader.py to

location = page.locator('[data-testid="post-container"] [data-test-id="post-content"]').bounding_box()

Really appreciate your time and effort. I tried the solution you gave but it still gives the same error.

again_error_cmd

grannymaster commented 3 months ago

Having the same issue.

EDIT: Seems to be only happening to me when story mode is disabled.

Here are my logs:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 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': 'dark', 'times_to_run': 9, 'opacity': 0.9, 'storymode': False,               β”‚
β”‚ 'storymodemethod': 1, 'storymode_max_length': 999999999, 'resolution_w': 1080, 'resolution_h': 1920, 'zoom': 1.0,   β”‚
β”‚ 'channel_name': 'dailyredditguy', 'background': {'background_video': 'minecraft', 'background_audio': 'lofi',       β”‚
β”‚ 'background_audio_volume': 0.01, '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', 'random_voice':       β”‚
β”‚ False, 'elevenlabs_voice_name': 'Bella', 'elevenlabs_api_key': 'REDACTED', 'aws_polly_voice': 'Brian',              β”‚
β”‚ 'streamlabs_polly_voice': 'Matthew', 'tiktok_voice': 'en_us_ghostface', 'tiktok_sessionid': 'REDACTED',             β”‚
β”‚ 'python_voice': '1', 'py_voice_num': '2', 'silence_duration': 0.3, 'no_emojis': False}}                             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
Traceback (most recent call last):
  File "C:\Users\admin\Downloads\RedditVideoMakerBot-master\main.py", line 131, in <module>
    raise err
  File "C:\Users\admin\Downloads\RedditVideoMakerBot-master\main.py", line 113, in <module>
    run_many(config["settings"]["times_to_run"])
  File "C:\Users\admin\Downloads\RedditVideoMakerBot-master\main.py", line 68, in run_many
    main()
  File "C:\Users\admin\Downloads\RedditVideoMakerBot-master\main.py", line 52, in main
    get_screenshots_of_reddit_posts(reddit_object, number_of_comments)
  File "C:\Users\admin\Downloads\RedditVideoMakerBot-master\video_creation\screenshot_downloader.py", line 203, in get_screenshots_of_reddit_posts
    raise e
  File "C:\Users\admin\Downloads\RedditVideoMakerBot-master\video_creation\screenshot_downloader.py", line 185, in get_screenshots_of_reddit_posts
    page.locator('[data-test-id="post-content"]').screenshot(path=postcontentpath)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\playwright\sync_api\_generated.py", line 16703, in screenshot
    self._sync(
  File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\playwright\_impl\_sync_base.py", line 115, in _sync
    return task.result()
  File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\playwright\_impl\_locator.py", line 531, in screenshot
    return await self._with_element(
  File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\playwright\_impl\_locator.py", line 108, in _with_element
    handle = await self.element_handle(timeout=timeout)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\playwright\_impl\_locator.py", line 311, in element_handle
    handle = await self._frame.wait_for_selector(
  File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\playwright\_impl\_frame.py", line 323, in wait_for_selector
    await self._channel.send("waitForSelector", locals_to_params(locals()))
  File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\playwright\_impl\_connection.py", line 59, in send
    return await self._connection.wrap_api_call(
  File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\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.screenshot: Timeout 30000ms exceeded.
Call log:
waiting for locator("[data-test-id=\"post-content\"]")
RequieMa commented 3 months ago

I tried to fix it by replacing

'[data-test-id="post-content"]' to f'[data-fullname="t3_{reddit_id}"]' page.locator(f"#t1_{comment['comment_id']}") to page.locator(f"#thing_t1_{comment['comment_id']}").locator("form").first

Can you check if they work for you?

OCEANOFANYTHINGOFFICIAL commented 3 months ago

Having the same issue.

EDIT: Seems to be only happening to me when story mode is disabled.

Here are my logs:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ 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': 'dark', 'times_to_run': 9, 'opacity': 0.9, 'storymode': False,               β”‚
β”‚ 'storymodemethod': 1, 'storymode_max_length': 999999999, 'resolution_w': 1080, 'resolution_h': 1920, 'zoom': 1.0,   β”‚
β”‚ 'channel_name': 'dailyredditguy', 'background': {'background_video': 'minecraft', 'background_audio': 'lofi',       β”‚
β”‚ 'background_audio_volume': 0.01, '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', 'random_voice':       β”‚
β”‚ False, 'elevenlabs_voice_name': 'Bella', 'elevenlabs_api_key': 'REDACTED', 'aws_polly_voice': 'Brian',              β”‚
β”‚ 'streamlabs_polly_voice': 'Matthew', 'tiktok_voice': 'en_us_ghostface', 'tiktok_sessionid': 'REDACTED',             β”‚
β”‚ 'python_voice': '1', 'py_voice_num': '2', 'silence_duration': 0.3, 'no_emojis': False}}                             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
Traceback (most recent call last):
  File "C:\Users\admin\Downloads\RedditVideoMakerBot-master\main.py", line 131, in <module>
    raise err
  File "C:\Users\admin\Downloads\RedditVideoMakerBot-master\main.py", line 113, in <module>
    run_many(config["settings"]["times_to_run"])
  File "C:\Users\admin\Downloads\RedditVideoMakerBot-master\main.py", line 68, in run_many
    main()
  File "C:\Users\admin\Downloads\RedditVideoMakerBot-master\main.py", line 52, in main
    get_screenshots_of_reddit_posts(reddit_object, number_of_comments)
  File "C:\Users\admin\Downloads\RedditVideoMakerBot-master\video_creation\screenshot_downloader.py", line 203, in get_screenshots_of_reddit_posts
    raise e
  File "C:\Users\admin\Downloads\RedditVideoMakerBot-master\video_creation\screenshot_downloader.py", line 185, in get_screenshots_of_reddit_posts
    page.locator('[data-test-id="post-content"]').screenshot(path=postcontentpath)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\playwright\sync_api\_generated.py", line 16703, in screenshot
    self._sync(
  File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\playwright\_impl\_sync_base.py", line 115, in _sync
    return task.result()
  File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\playwright\_impl\_locator.py", line 531, in screenshot
    return await self._with_element(
  File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\playwright\_impl\_locator.py", line 108, in _with_element
    handle = await self.element_handle(timeout=timeout)
  File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\playwright\_impl\_locator.py", line 311, in element_handle
    handle = await self._frame.wait_for_selector(
  File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\playwright\_impl\_frame.py", line 323, in wait_for_selector
    await self._channel.send("waitForSelector", locals_to_params(locals()))
  File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\site-packages\playwright\_impl\_connection.py", line 59, in send
    return await self._connection.wrap_api_call(
  File "C:\Users\admin\AppData\Local\Programs\Python\Python310\lib\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.screenshot: Timeout 30000ms exceeded.
Call log:
waiting for locator("[data-test-id=\"post-content\"]")

Yes, in story mode it works fine but when story mode is false, it throws up this error no matter what i do

OCEANOFANYTHINGOFFICIAL commented 3 months ago

I tried to fix it by replacing

'[data-test-id="post-content"]' to f'[data-fullname="t3_{reddit_id}"]' page.locator(f"#t1_{comment['comment_id']}") to page.locator(f"#thing_t1_{comment['comment_id']}").locator("form").first

Can you check if they work for you?

OK I'll try πŸ™‚

natefillups commented 3 months ago

Doesn't work for all cases. @RequieMa

OCEANOFANYTHINGOFFICIAL commented 3 months ago

Doesn't work for all cases. @RequieMa

What it means??

natefillups commented 3 months ago

Doesn't work for all cases. @RequieMa

What it means??

There is a different response from the chromium browser if you run it headless vs non-headless sometimes which is why @RequieMa was trying to change the element finder. I tried adding an try catch to cover both types of responses, but then I ran the program more and seem like there might be another type of response from the browser (or the element could be missing, I didn't look too much into it but I got a similar error).

natefillups commented 3 months ago

@OCEANOFANYTHINGOFFICIAL if you're looking for a quick fix run the program with headless=false.

OCEANOFANYTHINGOFFICIAL commented 3 months ago

@OCEANOFANYTHINGOFFICIAL if you're looking for a quick fix run the program with headless=false.

But won't it make the browser visible?

github-actions[bot] commented 2 months ago

This issue is stale because it has been open 7 days with no activity. Remove stale label or comment, or this will be closed in 10 days.

natefillups commented 2 months ago

duplicate of https://github.com/elebumm/RedditVideoMakerBot/issues/1971

github-actions[bot] commented 2 months ago

This issue is stale because it has been open 7 days with no activity. Remove stale label or comment, or this will be closed in 10 days.

nssharmaofficial commented 2 months ago

I had the same problem, solved it here. I am not sure which line exactly was the one that helped it, but it might help you if you have a look at it.

github-actions[bot] commented 1 month ago

This issue is stale because it has been open 7 days with no activity. Remove stale label or comment, or this will be closed in 10 days.

github-actions[bot] commented 1 month ago

This issue is stale because it has been open 7 days with no activity. Remove stale label or comment, or this will be closed in 10 days.

github-actions[bot] commented 1 month ago

Issue closed due to being stale. Please reopen if issue persists in latest version.