Closed slavikfoxy closed 7 months ago
Can I access the list of my videos in the playlist?
Hi, you can skip errors by using phub.utils.suppress
.
To access the lists of the videos you created in the playlist, you can simply filter videos that have you as an author:
for video in client.account.watched.sample(filter = lambda v: v.author.name == 'your-name'):
...
Direct user objects comparisons is something that should be added in the future.
Concerning the regex error, can you share what videos/types raise these errors, so the project can be updated?
593
594
595
Pattern [91mid=\"(.?)\".?-vkey=\"(.?)\".?title=\"(.?)\".?src=\"(.?)\".?-mediabook=\"(.?)\".?marker-overlays.?>(.?)</div[0m failed
Traceback (most recent call last):
File "C:\Users\oliyn\OneDrive\Documents\ghub\CheckMissVideo.py", line 195, in
phub.utils.suppress did not help
You need to specify which error you need to supress. In your case, phub.errors.RegexError
I figured out how to use suppress, for video in suppress(client.account.watched, phub.errors.RegexError):but it exits the loop Pattern [91mid=\"(.?)\".?-vkey=\"(.?)\".?title=\"(.?)\".?src=\"(.?)\".?-mediabook=\"(.?)\".?marker-overlays.?>(.?)</div[0m failed Suppressing the error Find regex failed..: RegexError('Find regex failed.') and the function for video in (client.account.watched.sample(filter = lambda v: v.author.name == 'MyNaMe')): print(f'{video.title}'): does not print any result
Make sure you are using the right name (e.g. from client.account.name) and you have watched your videos.
I can't get more than 47 videos, is it just me? it happened 3 days ago.
It's not just you. My history got striped out too. It's a problem on Pornhub side, and it sucks.
Concerning this error, i cannot work on PHUB anymore so you will have to see with @EchterAlsFake. I still believe this was due to some pornhub videos you have watched in the past not being available anymore on pornhub (banned from your country, removed by pornhub or author, etc.). This is a pain in the ass to debug since it depends only on your history. That's why i implemented VideoError and utils.supress, which apparently stopped working for some reason. Anyway if your history remains deleted, at least you won't have the problem (for now).
I think I broke my account )
at least there are no errors
@slavikfoxy
Hey, if you are still there... If it would be possible for you, please update to the newest PHUB release and execute your script from february once again. If it still gives you the Pattern failed error, please run the same script again, but print out the URLs at the beginning, so that we can identify the exact video where it fails. This would be great, thank you :)
What code should I write to get the url of 926 videos?
phub.Video(key=65ac5d1a2b3d4), on version 4.2.0 the pattern works
Hey, this should be fixed now. Please update from the latest commit and tell us if it works.
Pattern [91mid=\"(.?)\".?-vkey=\"(.?)\".?title=\"(.?)\".?src=\"(.?)\".?-mediabook=\"(.?)\".?marker-overlays.?>(.?)</div[0m failed Traceback (most recent call last): File "C:\Users\oliyn\OneDrive\Documents\ghub\CheckMissVideo.py", line 191, in
imput()
File "C:\Users\oliyn\OneDrive\Documents\ghub\CheckMissVideo.py", line 57, in imput
for i, video in enumerate(client.account.watched):
File "C:\Users\oliyn\AppData\Local\Programs\Python\Python312\Lib\site-packages\phub\objects\query.py", line 109, in iter
for item in page:
File "C:\Users\oliyn\AppData\Local\Programs\Python\Python312\Lib\site-packages\phub\objects\query.py", line 335, in _iter_page
wrapped: QueryItem = self._parse_item(item)
File "C:\Users\oliyn\AppData\Local\Programs\Python\Python312\Lib\site-packages\phub\objects\query.py", line 305, in _parse_item
data = self._eval_video(raw)
File "C:\Users\oliyn\AppData\Local\Programs\Python\Python312\Lib\site-packages\phub\objects\query.py", line 298, in _eval_video
data = {k: v for k, v in zip(keys, consts.re.eval_video(raw))} | {'raw': raw}
File "C:\Users\oliyn\AppData\Local\Programs\Python\Python312\Lib\site-packages\phub\consts.py", line 86, in wrapper
raise errors.RegexError('Find regex failed.')
phub.errors.RegexError: Find regex failed.
how can I skip this error in the loop for i, video in enumerate(client.account.watched)