elebumm / RedditVideoMakerBot

Create Reddit Videos with just✨ one command ✨

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug]: screenshots are not getting due to changed html of reddit

spaidevelopers opened this issue · comments

Describe the bug

Traceback (most recent call last):
File "/Users/tousifkhan/projects/development/python/RedditVideoMakerBot/main.py", line 132, in
raise err
File "/Users/tousifkhan/projects/development/python/RedditVideoMakerBot/main.py", line 114, in
run_many(config["settings"]["times_to_run"])
File "/Users/tousifkhan/projects/development/python/RedditVideoMakerBot/main.py", line 69, in run_many
main()
File "/Users/tousifkhan/projects/development/python/RedditVideoMakerBot/main.py", line 53, in main
get_screenshots_of_reddit_posts(reddit_object, number_of_comments)
File "/Users/tousifkhan/projects/development/python/RedditVideoMakerBot/video_creation/screenshot_downloader.py", line 278, in get_screenshots_of_reddit_posts
page.locator(f"#t1_{comment['comment_id']}").screenshot(
File "/Users/tousifkhan/projects/development/python/RedditVideoMakerBot/rbot/lib/python3.10/site-packages/playwright/sync_api/_generated.py", line 17568, in screenshot
self._sync(
File "/Users/tousifkhan/projects/development/python/RedditVideoMakerBot/rbot/lib/python3.10/site-packages/playwright/_impl/_sync_base.py", line 109, in _sync
return task.result()
File "/Users/tousifkhan/projects/development/python/RedditVideoMakerBot/rbot/lib/python3.10/site-packages/playwright/_impl/_locator.py", line 529, in screenshot
return await self._with_element(
File "/Users/tousifkhan/projects/development/python/RedditVideoMakerBot/rbot/lib/python3.10/site-packages/playwright/_impl/_locator.py", line 115, in _with_element
handle = await self.element_handle(timeout=timeout)
File "/Users/tousifkhan/projects/development/python/RedditVideoMakerBot/rbot/lib/python3.10/site-packages/playwright/_impl/_locator.py", line 315, in element_handle
handle = await self._frame.wait_for_selector(
File "/Users/tousifkhan/projects/development/python/RedditVideoMakerBot/rbot/lib/python3.10/site-packages/playwright/_impl/_frame.py", line 322, in wait_for_selector
await self._channel.send("waitForSelector", locals_to_params(locals()))
File "/Users/tousifkhan/projects/development/python/RedditVideoMakerBot/rbot/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 61, in send
return await self._connection.wrap_api_call(
File "/Users/tousifkhan/projects/development/python/RedditVideoMakerBot/rbot/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 482, in wrap_api_call
return await cb()
File "/Users/tousifkhan/projects/development/python/RedditVideoMakerBot/rbot/lib/python3.10/site-packages/playwright/_impl/_connection.py", line 97, in inner_send
result = next(iter(done)).result()
playwright._impl._api_types.TimeoutError: Timeout 30000ms exceeded.

Reproduction Steps

the classes are not getting found to take a screenshot
eg.
location = page.locator('[data-post-click-location="text-body"]').bounding_box()

this html selector not exist similarly comment selector also not exist

location = page.locator(f"#t1_{comment['comment_id']}").bounding_box()

Expected behavior

take the screenshots of post and comments

Screenshots

No response

System Information

Operating System : MacOS
Python version : Python 3.10
App version / Branch : master

Checklist

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

Additional Context

No response

here the fix for post screen shot
old code
page.locator('[data-post-click-location="text-body"]').screenshot(path=postcontentpath)

replace with this one
page.locator('shreddit-post.block').screenshot(path=postcontentpath)

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.

commented

I encountered a similar issue with login. For me it timed out on
page.locator("[name=\"username\"]")
Currently looking for a suitable replacement

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.

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