EchterAlsFake / PHUB

A lightweight API for Pornhub
https://phub.rtfd.io
GNU General Public License v3.0
64 stars 22 forks source link

why error after search #45

Closed bobwatcherx closed 7 months ago

bobwatcherx commented 7 months ago

i get error when search . its normal or not .

C:\Users\LENOVO\Pictures\mainan\webdood>python -m phub search toge ph5f0310a388dd4 - ngentot toge kaya raya ph5eabc148e9cb3 - พี่กับน้องเล่นเย็ดกันParents are not at home. try playing sex toge Invalid API response from https://www.pornhub.com/webmasters/search?search=toge&page={page} Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python311\Lib\site-packages\phub__main.py", line 84, in cli() File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1157, in call return self.main(*args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1078, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 1434, in invoke return ctx.invoke(self.callback, ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python311\Lib\site-packages\click\core.py", line 783, in invoke return callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python311\Lib\site-packages\phub__main.py", line 72, in search for video in client.search(entry).sample(int(max)): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python311\Lib\site-packages\phub\objects\query.py", line 131, in sample for item in self: File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python311\Lib\site-packages\phub\objects\query.py", line 108, in iter__ for page in self.pages: File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python311\Lib\site-packages\phub\objects\query.py", line 95, in pages page = self._get_page(i) ^^^^^^^^^^^^^^^^^ File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python311\Lib\site-packages\phub\objects\query.py", line 178, in _get_page els = self._parse_page(raw) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\LENOVO\AppData\Local\Programs\Python\Python311\Lib\site-packages\phub\objects\query.py", line 263, in _parse_page raise errors.ParsingError('Invalid API response') phub.errors.ParsingError: Invalid API response

bobwatcherx commented 7 months ago

but data result search sucecss show

Egsagon commented 7 months ago

Fixed. There was just no more videos in the query.

bobwatcherx commented 7 months ago

Fixed. There was just no more videos in the query.

I want to find videos. is there a parameter to limit the duration. For example, I want to find a duration of 30 minutes or more. on the video I want

import phub from phub.locals import *

Initialise a client

client = phub.Client()

Perform a research

for video in client.search('toge'): print(video.title) print(video.url)

Egsagon commented 7 months ago

Yes, that is possible.

import phub

client = phub.Client()

def filter_long_videos(video: phub.Video):
    return video.duration.total_seconds() > 30 * 60

for video in client.search('toge').sample(filter = filter_long_videos):

    print(video, video.duration)