Closed slavikfoxy closed 11 months ago
Hi, I'm not able to replicate the issue. What PHUB version are you using? Does your account history page renders correctly on your browser? Do you have a watch history on this account? If yes, does it contains videos?
Hi, I'm not able to replicate the issue. What PHUB version are you using? Does your account history page renders correctly on your browser? Do you have a watch history on this account? If yes, does it contains videos?
sorry, I wrote it wrong, {video.image.url} is causing an error print(f'{i}. [{video.key}] "{video.title}" {video.image.url}')
Can you provide the url or viewkey of the video that raises this error?
the error occurs on 64 videos tried client.account.watched and client.account.liked the code works correctly without {video.image.url}
print(f'{i}. "{video.title}" ')
Output ......
Can you do something like:
for i, video in enumerate(client.account.watched):
try:
video.image.url
except:
print(video.key)
This will list all keys of the videos with this bug
= RESTART: C:\Users\oliyn\OneDrive\Documents\PYTHON PROJEKT\import PH.py
Traceback (most recent call last):
File "C:\Users\oliyn\OneDrive\Documents\PYTHON PROJEKT\import PH.py", line 10, in
I found another error in query.py file line 248 PAGE_LENGTH = 32, i get 3735 videos, if i change to 40 - 4663 videos 42 - 4895. i am looking for the number at which all my videos will be - 5592
Can you please execute the code i have provided and copy its result so i can debug it on my end.
Concerning the second error, fixed page length is a flaw in the query structure anyway. I will look into it.
Чи можете ви виконати наданий мною код і скопіювати його результат, щоб я міг налагодити його самостійно.
Що стосується другої помилки, фіксована довжина сторінки все одно є недоліком у структурі запиту. Я розгляну це.
import phub
from phub.locals import * client = phub.Client('123@', '321')
for i, video in enumerate(client.account.watched): try: video.image.url except: print(video.key)
OUTPUT
Traceback (most recent call last):
File "C:\Users\oliyn\OneDrive\Documents\PYTHON PROJEKT\import PH2.py", line 6, in
Sorry, i don't understand your error. Is it with video.image.url or client.account.watched? If the last error you posted is related to client.account.watched, where comes the output from https://github.com/Egsagon/PHUB/issues/30#issuecomment-1830218922 ?
the video.image.url argument causes an error after 64 videos, for example, video.tags does too, but {video.key} and {video.title} do not
import phub
from phub.locals import * client = phub.Client('12356@', '88555444')
for i, video in enumerate(client.account.watched): print(f'{i}. "{video.title}" {video.tags}') ... print(f'{i}. "{video.title}" {video.image.url}')
... print(f'{i}. "{video.title}" ')
video.image.url and video.tags require PHUB to directly fetch the video, whether using HubTraffic or web scrapping the video page. I wasn't able to replicate your issue with none of my accounts. The only issue i get is PH servers spam protection, which, unlike your error, raises a requests.exceptions.ConnectionError exception. Therefore, i assume your error is due to PH blocking you for too many requests. There is a chance that PH sent you its challenge page for you to slow down, which was the issue in #5. However this has been de-implemented since i thought they removed it. Before i add it back however, see if adding a delay fixes your error. Use the built-in client delayer.
...
client = phub.Client('username', 'password', delay = .5)
...
Alternatively, but i doubt this is the issue, check your PHUB version and try to update it.
Thank you, it worked
received a new error .......
Traceback (most recent call last):
File "C:\Users\oliyn\OneDrive\Documents\PYTHON PROJEKT\import PH.py", line 12, in
This error probably comes from Pornhub refusing to send the video data. This is usually the case when a video has become private or has been deleted, which can happen if you are iterating through an history. I will implement error handling for this in PHUB, so the error is more explicit.
I will also probably implement a util that allows to iterate through a query without raising this type of error (like contextlib.suppress) or put it directly inside queries generators.
Lastly, concerning your first error fixed with the delayer, i still believe that is because of the PH challenge. I will also reimplement it at the scale of the client calls.
I found another error in query.py file line 248 PAGE_LENGTH = 32, i get 3735 videos, if i change to 40 - 4663 videos 42 - 4895. i am looking for the number at which all my videos will be - 5592
I can't get the full list of my videos, I tried changing the parameter PAGE_LENGTH = 32, each time I get a different number of videos.
This error probably comes from Pornhub refusing to send the video data. This is usually the case when a video has become private or has been deleted, which can happen if you are iterating through an history.
I have implemented a VideoError exception that raises when this happens. Since most of the time you want to ignore these errors, i have implemented a suppress function that ignore errored videos and pass on to the next one.
import phub
from phub.utils import suppress
client = phub.Client(...)
for video in suppress( client.account.watched ):
print(video.key, video.image.url)
I can't get the full list of my videos, I tried changing the parameter PAGE_LENGTH = 32, each time I get a different number of videos.
This is a regex problem, it will take its time.
I found another error in query.py file line 248 PAGE_LENGTH = 32, i get 3735 videos, if i change to 40 - 4663 videos 42 - 4895. i am looking for the number at which all my videos will be - 5592
Please update PHUB from this repository and tell me if c063d0c fixes the error.
import phub import codecs import shutil
from phub.locals import * client = phub.Client('login', '1')
for i, video in enumerate(client.account.watched): print(f'{i}. {video.image.url}') END CODE
Traceback (most recent call last): File "C:\Users\oliyn\OneDrive\Documents\PYTHON PROJEKT\import PH.py", line 10, in
for i, video in enumerate(client.account.liked):
File "C:\Users\oliyn\AppData\Local\Programs\Python\Python312\Lib\site-packages\phub\objects\query.py", line 104, in next
return self.get(self.iter_index)
File "C:\Users\oliyn\AppData\Local\Programs\Python\Python312\Lib\site-packages\phub\objects\query.py", line 127, in get
page = self._get_page(index // self.PAGE_LENGTH)
File "C:\Users\oliyn\AppData\Local\Programs\Python\Python312\Lib\site-packages\phub\objects\query.py", line 169, in _get_page
return self._parse_page(raw)
File "C:\Users\oliyn\AppData\Local\Programs\Python\Python312\Lib\site-packages\phub\objects\query.py", line 271, in _parse_page
container = raw.split('class="container')[1]
IndexError: list index out of range