RedditVideoMakerBot icon indicating copy to clipboard operation
RedditVideoMakerBot copied to clipboard

[Bug]: TypeError: Cannot set properties of null

Open josylad opened this issue 1 year ago • 9 comments

Describe the bug

It starts off fine but when it gets to the point of translating the post, it throws an error.

Reproduction Steps

set ai_similarity_enabled = true Launch the program (py main.py) and wait.

Expected behavior

run smoothly and make a video

Screenshots

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: Page.evaluate: TypeError: Cannot set properties of null (setting │
│ 'textContent')                                                          │
│     at eval (eval at evaluate (:226:30), <anonymous>:1:101)             │
│     at UtilityScript.evaluate (<anonymous>:233:19)                      │
│     at UtilityScript.<anonymous> (<anonymous>:1:44)                     │
│ Config: {'allow_nsfw': False, 'theme': 'light', 'times_to_run': 1,      │
│ 'opacity': 0.7, 'storymode': False, 'storymodemethod': 1,               │
│ 'storymode_max_length': 1000, 'resolution_w': 1080, 'resolution_h':     │
│ 1920, 'zoom': 1.2, 'channel_name': 'Reddit Tales', 'background':        │
│ {'background_video': 'minecraft', 'background_audio': 'lofi',           │
│ 'background_audio_volume': 0.05, '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': 'tiktok', '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}}                                                    │
╰─────────────────────────────────────────────────────────────────────────╯
Traceback (most recent call last):
  File "/home/josylad/Documents/Projects/RedditVideoMakerBot/main.py", line 131, in <module>
    raise err
  File "/home/josylad/Documents/Projects/RedditVideoMakerBot/main.py", line 113, in <module>
    run_many(config["settings"]["times_to_run"])
  File "/home/josylad/Documents/Projects/RedditVideoMakerBot/main.py", line 68, in run_many
    main()
  File "/home/josylad/Documents/Projects/RedditVideoMakerBot/main.py", line 52, in main
    get_screenshots_of_reddit_posts(reddit_object, number_of_comments)
  File "/home/josylad/Documents/Projects/RedditVideoMakerBot/video_creation/screenshot_downloader.py", line 165, in get_screenshots_of_reddit_posts
    page.evaluate(
  File "/home/josylad/Documents/Projects/RedditVideoMakerBot/virtual/lib/python3.10/site-packages/playwright/sync_api/_generated.py", line 8183, in evaluate
    self._sync(
  File "/home/josylad/Documents/Projects/RedditVideoMakerBot/virtual/lib/python3.10/site-packages/playwright/_impl/_sync_base.py", line 115, in _sync
    return task.result()
  File "/home/josylad/Documents/Projects/RedditVideoMakerBot/virtual/lib/python3.10/site-packages/playwright/_impl/_page.py", line 435, in evaluate
    return await self._main_frame.evaluate(expression, arg)
  File "/home/josylad/Documents/Projects/RedditVideoMakerBot/virtual/lib/python3.10/site-packages/playwright/_impl/_frame.py", line 278, in evaluate
    await self._channel.send(
  File "/home/josylad/Documents/Projects/RedditVideoMakerBot/virtual/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 59, in send
    return await self._connection.wrap_api_call(
  File "/home/josylad/Documents/Projects/RedditVideoMakerBot/virtual/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.Error: Page.evaluate: TypeError: Cannot set properties of null (setting 'textContent')
    at eval (eval at evaluate (:226:30), <anonymous>:1:101)
    at UtilityScript.evaluate (<anonymous>:233:19)
    at UtilityScript.<anonymous> (<anonymous>:1:44)

System Information

Operating System : Ubuntu 22.04 Python version : Python 3.10 App version / Branch : 3.3.0

Checklist

  • [X] I have searched the open issues for duplicates.
  • [X] I have shown the entire traceback, if possible.

Additional Context

It works if I set: ai_similarity_enabled = false

josylad avatar Sep 04 '24 01:09 josylad

any fix with screenshot error post ?

Superkaizhen07 avatar Sep 05 '24 07:09 Superkaizhen07

I have the same problem.

needkg avatar Sep 08 '24 14:09 needkg

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] avatar Sep 15 '24 00:09 github-actions[bot]

does #2138 fix this for anyone here?

JasonLovesDoggo avatar Sep 18 '24 04:09 JasonLovesDoggo

I got this error because I put the wrong reddit password in my config.toml

xtb7 avatar Sep 30 '24 14:09 xtb7

I am getting this as well, confirmed user and password, even going as far as creating a new account. Only happens after "Logging into reddit..."

jordanbr20 avatar Oct 16 '24 16:10 jordanbr20

Confirmed this is also happening to me after verifying username and password. Full trace

(.venv) ~\Projects\RedditVideoMakerBot-3.3.0  py .\main.py

██████╗ ███████╗██████╗ ██████╗ ██╗████████╗    ██╗   ██╗██╗██████╗ ███████╗ ██████╗     ███╗   ███╗ █████╗ ██╗  ██╗███████╗██████╗
██╔══██╗██╔════╝██╔══██╗██╔══██╗██║╚══██╔══╝    ██║   ██║██║██╔══██╗██╔════╝██╔═══██╗    ████╗ ████║██╔══██╗██║ ██╔╝██╔════╝██╔══██╗
██████╔╝█████╗  ██║  ██║██║  ██║██║   ██║       ██║   ██║██║██║  ██║█████╗  ██║   ██║    ██╔████╔██║███████║█████╔╝ █████╗  ██████╔╝
██╔══██╗██╔══╝  ██║  ██║██║  ██║██║   ██║       ╚██╗ ██╔╝██║██║  ██║██╔══╝  ██║   ██║    ██║╚██╔╝██║██╔══██║██╔═██╗ ██╔══╝  ██╔══██╗
██║  ██║███████╗██████╔╝██████╔╝██║   ██║        ╚████╔╝ ██║██████╔╝███████╗╚██████╔╝    ██║ ╚═╝ ██║██║  ██║██║  ██╗███████╗██║  ██║
╚═╝  ╚═╝╚══════╝╚═════╝ ╚═════╝ ╚═╝   ╚═╝         ╚═══╝  ╚═╝╚═════╝ ╚══════╝ ╚═════╝     ╚═╝     ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝



    Thanks for using this tool! Feel free to contribute to this project on GitHub! If you have any questions, feel free to join my Discord
                    server or submit a GitHub issue. You can find solutions to many common problems in the documentation:
                                                 https://reddit-video-maker-bot.netlify.app/


╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ You are using the newest version (3.3.0) of the bot                                                                                        │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
###############################
#                             #
# Checking TOML configuration #
#                             #
###############################
If you see any prompts, that means that you have unset/incorrectly set variables, please input the correct values.
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ on the 1st iteration of 3                                                                                                                  │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Logging into Reddit.
Version 7.7.1 of praw is outdated. Version 7.8.1 was released Friday October 25, 2024.
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Getting subreddit threads...                                                                                                               │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Using subreddit: r/AskReddit+AITA+AmIOverreacting+relationship_advice+confessions from TOML config
Video will be: lets ignore the US for a second, how’s the rest of the world doing? 👍
Thread url is: https://new.reddit.com//r/AskReddit/comments/1inr2bj/lets_ignore_the_us_for_a_second_hows_the_rest_of/ 👍
Thread has 7548 upvotes
Thread has a upvote ratio of 88.0%
Thread has 3357 comments
Received subreddit threads Successfully.
Thread ID is 1inr2bj
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Saving Text to MP3 files...                                                                                                                │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Translating Text...
Saving... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━   Translating Text...
Saving... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━   Translating Text...
Saving... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.2 it/s
Saved Text to MP3 files successfully.
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Downloading screenshots of reddit posts...                                                                                                 │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Launching Headless Browser...
Logging in to Reddit...
Translating post...
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ 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: Page.evaluate: TypeError: Cannot set properties of null (setting 'textContent')                                                     │
│     at eval (eval at evaluate (:226:30), <anonymous>:1:101)                                                                                │
│     at UtilityScript.evaluate (<anonymous>:233:19)                                                                                         │
│     at UtilityScript.<anonymous> (<anonymous>:1:44)                                                                                        │
│ Config: {'allow_nsfw': False, 'theme': 'dark', 'times_to_run': 3, 'opacity': 0.9, 'storymode': False, 'storymodemethod': 1,                │
│ 'storymode_max_length': 1000, 'resolution_w': 1080, 'resolution_h': 1920, 'zoom': 1.0, 'channel_name': 'That Happened??!', '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}}                    │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Traceback (most recent call last):
  File "C:\Users\Aareon\Projects\RedditVideoMakerBot-3.3.0\main.py", line 131, in <module>
    raise err
  File "C:\Users\Aareon\Projects\RedditVideoMakerBot-3.3.0\main.py", line 113, in <module>
    run_many(config["settings"]["times_to_run"])
  File "C:\Users\Aareon\Projects\RedditVideoMakerBot-3.3.0\main.py", line 68, in run_many
    main()
  File "C:\Users\Aareon\Projects\RedditVideoMakerBot-3.3.0\main.py", line 52, in main
    get_screenshots_of_reddit_posts(reddit_object, number_of_comments)
  File "C:\Users\Aareon\Projects\RedditVideoMakerBot-3.3.0\video_creation\screenshot_downloader.py", line 165, in get_screenshots_of_reddit_posts
    page.evaluate(
  File "C:\Users\Aareon\Projects\RedditVideoMakerBot-3.3.0\.venv\lib\site-packages\playwright\sync_api\_generated.py", line 8183, in evaluate
    self._sync(
  File "C:\Users\Aareon\Projects\RedditVideoMakerBot-3.3.0\.venv\lib\site-packages\playwright\_impl\_sync_base.py", line 115, in _sync
    return task.result()
  File "C:\Users\Aareon\Projects\RedditVideoMakerBot-3.3.0\.venv\lib\site-packages\playwright\_impl\_page.py", line 435, in evaluate
    return await self._main_frame.evaluate(expression, arg)
  File "C:\Users\Aareon\Projects\RedditVideoMakerBot-3.3.0\.venv\lib\site-packages\playwright\_impl\_frame.py", line 278, in evaluate
    await self._channel.send(
  File "C:\Users\Aareon\Projects\RedditVideoMakerBot-3.3.0\.venv\lib\site-packages\playwright\_impl\_connection.py", line 59, in send
    return await self._connection.wrap_api_call(
  File "C:\Users\Aareon\Projects\RedditVideoMakerBot-3.3.0\.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.Error: Page.evaluate: TypeError: Cannot set properties of null (setting 'textContent')
    at eval (eval at evaluate (:226:30), <anonymous>:1:101)
    at UtilityScript.evaluate (<anonymous>:233:19)
    at UtilityScript.<anonymous> (<anonymous>:1:44)

Aareon avatar Feb 12 '25 20:02 Aareon

Confirmed this is also happening to me after verifying username and password. Full trace

(.venv) ~\Projects\RedditVideoMakerBot-3.3.0  py .\main.py

██████╗ ███████╗██████╗ ██████╗ ██╗████████╗    ██╗   ██╗██╗██████╗ ███████╗ ██████╗     ███╗   ███╗ █████╗ ██╗  ██╗███████╗██████╗
██╔══██╗██╔════╝██╔══██╗██╔══██╗██║╚══██╔══╝    ██║   ██║██║██╔══██╗██╔════╝██╔═══██╗    ████╗ ████║██╔══██╗██║ ██╔╝██╔════╝██╔══██╗
██████╔╝█████╗  ██║  ██║██║  ██║██║   ██║       ██║   ██║██║██║  ██║█████╗  ██║   ██║    ██╔████╔██║███████║█████╔╝ █████╗  ██████╔╝
██╔══██╗██╔══╝  ██║  ██║██║  ██║██║   ██║       ╚██╗ ██╔╝██║██║  ██║██╔══╝  ██║   ██║    ██║╚██╔╝██║██╔══██║██╔═██╗ ██╔══╝  ██╔══██╗
██║  ██║███████╗██████╔╝██████╔╝██║   ██║        ╚████╔╝ ██║██████╔╝███████╗╚██████╔╝    ██║ ╚═╝ ██║██║  ██║██║  ██╗███████╗██║  ██║
╚═╝  ╚═╝╚══════╝╚═════╝ ╚═════╝ ╚═╝   ╚═╝         ╚═══╝  ╚═╝╚═════╝ ╚══════╝ ╚═════╝     ╚═╝     ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝╚══════╝╚═╝  ╚═╝



    Thanks for using this tool! Feel free to contribute to this project on GitHub! If you have any questions, feel free to join my Discord
                    server or submit a GitHub issue. You can find solutions to many common problems in the documentation:
                                                 https://reddit-video-maker-bot.netlify.app/


╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ You are using the newest version (3.3.0) of the bot                                                                                        │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
###############################
#                             #
# Checking TOML configuration #
#                             #
###############################
If you see any prompts, that means that you have unset/incorrectly set variables, please input the correct values.
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ on the 1st iteration of 3                                                                                                                  │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Logging into Reddit.
Version 7.7.1 of praw is outdated. Version 7.8.1 was released Friday October 25, 2024.
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Getting subreddit threads...                                                                                                               │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Using subreddit: r/AskReddit+AITA+AmIOverreacting+relationship_advice+confessions from TOML config
Video will be: lets ignore the US for a second, how’s the rest of the world doing? 👍
Thread url is: https://new.reddit.com//r/AskReddit/comments/1inr2bj/lets_ignore_the_us_for_a_second_hows_the_rest_of/ 👍
Thread has 7548 upvotes
Thread has a upvote ratio of 88.0%
Thread has 3357 comments
Received subreddit threads Successfully.
Thread ID is 1inr2bj
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Saving Text to MP3 files...                                                                                                                │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Translating Text...
Saving... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━   Translating Text...
Saving... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━   Translating Text...
Saving... ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.2 it/s
Saved Text to MP3 files successfully.
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Downloading screenshots of reddit posts...                                                                                                 │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Launching Headless Browser...
Logging in to Reddit...
Translating post...
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ 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: Page.evaluate: TypeError: Cannot set properties of null (setting 'textContent')                                                     │
│     at eval (eval at evaluate (:226:30), <anonymous>:1:101)                                                                                │
│     at UtilityScript.evaluate (<anonymous>:233:19)                                                                                         │
│     at UtilityScript.<anonymous> (<anonymous>:1:44)                                                                                        │
│ Config: {'allow_nsfw': False, 'theme': 'dark', 'times_to_run': 3, 'opacity': 0.9, 'storymode': False, 'storymodemethod': 1,                │
│ 'storymode_max_length': 1000, 'resolution_w': 1080, 'resolution_h': 1920, 'zoom': 1.0, 'channel_name': 'That Happened??!', '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}}                    │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Traceback (most recent call last):
  File "C:\Users\Aareon\Projects\RedditVideoMakerBot-3.3.0\main.py", line 131, in <module>
    raise err
  File "C:\Users\Aareon\Projects\RedditVideoMakerBot-3.3.0\main.py", line 113, in <module>
    run_many(config["settings"]["times_to_run"])
  File "C:\Users\Aareon\Projects\RedditVideoMakerBot-3.3.0\main.py", line 68, in run_many
    main()
  File "C:\Users\Aareon\Projects\RedditVideoMakerBot-3.3.0\main.py", line 52, in main
    get_screenshots_of_reddit_posts(reddit_object, number_of_comments)
  File "C:\Users\Aareon\Projects\RedditVideoMakerBot-3.3.0\video_creation\screenshot_downloader.py", line 165, in get_screenshots_of_reddit_posts
    page.evaluate(
  File "C:\Users\Aareon\Projects\RedditVideoMakerBot-3.3.0\.venv\lib\site-packages\playwright\sync_api\_generated.py", line 8183, in evaluate
    self._sync(
  File "C:\Users\Aareon\Projects\RedditVideoMakerBot-3.3.0\.venv\lib\site-packages\playwright\_impl\_sync_base.py", line 115, in _sync
    return task.result()
  File "C:\Users\Aareon\Projects\RedditVideoMakerBot-3.3.0\.venv\lib\site-packages\playwright\_impl\_page.py", line 435, in evaluate
    return await self._main_frame.evaluate(expression, arg)
  File "C:\Users\Aareon\Projects\RedditVideoMakerBot-3.3.0\.venv\lib\site-packages\playwright\_impl\_frame.py", line 278, in evaluate
    await self._channel.send(
  File "C:\Users\Aareon\Projects\RedditVideoMakerBot-3.3.0\.venv\lib\site-packages\playwright\_impl\_connection.py", line 59, in send
    return await self._connection.wrap_api_call(
  File "C:\Users\Aareon\Projects\RedditVideoMakerBot-3.3.0\.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.Error: Page.evaluate: TypeError: Cannot set properties of null (setting 'textContent')
    at eval (eval at evaluate (:226:30), <anonymous>:1:101)
    at UtilityScript.evaluate (<anonymous>:233:19)
    at UtilityScript.<anonymous> (<anonymous>:1:44)

Ever find a fix for this? Having the exact same log error right now

KawaiiBunga avatar Jun 05 '25 03:06 KawaiiBunga

It's related to the thread id used. Change the reddit thread id in your config

Aareon avatar Jun 06 '25 01:06 Aareon