alexlaverty / python-reddit-youtube-bot

Automated Reddit Youtube Video Bot
https://www.youtube.com/channel/UCzIwW92D_rM5_yvWBsquSbw
75 stars 17 forks source link

[screenshot] trying to address some things: ... #104

Closed azrafe7 closed 6 months ago

azrafe7 commented 6 months ago
azrafe7 commented 6 months ago

Hello, and thank for your code. ;D Was fiddling with it as I needed it for a project of mine, and thought to contribute back... Should have made a more granular PR, sorry, but hopefully my attempts/changes are still useful to you.

sebbourgeois commented 6 months ago

Thanks for this update @azrafe7 ! I gave it a try on my end, there are still comments that are not working ie.

Mmmmhhh... could not create screenshot!
Downloading screenshot 'assets/work_dir/1amhqvu/comment_kpmlm46.png'...
Mmmmhhh... could not create screenshot!
Downloading screenshot 'assets/work_dir/1amhqvu/comment_kpphfxm.png'...
Mmmmhhh... could not create screenshot!
Downloading screenshot 'assets/work_dir/1amhqvu/comment_kq25wta.png'...
Mmmmhhh... could not create screenshot!

But overall it handles the comments in a better way and it doesn't generate anymore these big long ass comments' screenshots !

alexlaverty commented 6 months ago

I agree thanks for putting in the effort, have merged in your PR, I ran it from my local machine and from github action workflow which is how I schedule it, both was seeing a number of comments not able to screenshot :

Downloading screenshot 'assets/work_dir/1au2att/comment_kr20mgy.png'...
Downloading screenshot 'assets/work_dir/1au2att/comment_kr1ovqv.png'...
Downloading screenshot 'assets/work_dir/1au2att/comment_kr1ooqj.png'...
Mmmmhhh... could not create screenshot!
Downloading screenshot 'assets/work_dir/1au2att/comment_kr1nted.png'...
Mmmmhhh... could not create screenshot!
Downloading screenshot 'assets/work_dir/1au2att/comment_kr1ubn0.png'...
Mmmmhhh... could not create screenshot!

Seems reddit is changing its layout a lot lately and also with the random popups it does etc makes it hard to automate the comment screenshots, i'd say they're doing it on purpose to make it harder for screen scraping... : /

They also like to randomly toggle between old reddit style and new reddit style, so need to cater for all scenarios.

azrafe7 commented 6 months ago

I agree thanks for putting in the effort, have merged in your PR, I ran it from my local machine and from github action workflow which is how I schedule it, both was seeing a number of comments not able to screenshot :

Downloading screenshot 'assets/work_dir/1au2att/comment_kr20mgy.png'...
Downloading screenshot 'assets/work_dir/1au2att/comment_kr1ovqv.png'...
Downloading screenshot 'assets/work_dir/1au2att/comment_kr1ooqj.png'...
Mmmmhhh... could not create screenshot!
Downloading screenshot 'assets/work_dir/1au2att/comment_kr1nted.png'...
Mmmmhhh... could not create screenshot!
Downloading screenshot 'assets/work_dir/1au2att/comment_kr1ubn0.png'...
Mmmmhhh... could not create screenshot!

Seems reddit is changing its layout a lot lately and also with the random popups it does etc makes it hard to automate the comment screenshots, i'd say they're doing it on purpose to make it harder for screen scraping... : /

They also like to randomly toggle between old reddit style and new reddit style, so need to cater for all scenarios.

Hi @alexlaverty,

And yes, even the login page changes randomly (as you already know of course), and ids and classes and timeouts. ;P

Hopeully the error about "screenshot not being created" has been solved by going to the permalink as you suggested in your code.

I've updated the latest PR (https://github.com/alexlaverty/python-reddit-youtube-bot/pull/105) (not too clean I know, but maybe helpful... for sure your code helped me, thanks! :)

Cheers, azrafe7