phub 4.8.4__tar.gz → 4.8.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. {phub-4.8.4 → phub-4.8.6}/PKG-INFO +1 -1
  2. {phub-4.8.4 → phub-4.8.6}/pyproject.toml +1 -1
  3. {phub-4.8.4 → phub-4.8.6}/src/phub/core.py +4 -5
  4. {phub-4.8.4 → phub-4.8.6}/src/phub/modules/parser.py +1 -1
  5. {phub-4.8.4 → phub-4.8.6}/src/phub/objects/query.py +8 -5
  6. {phub-4.8.4 → phub-4.8.6}/src/phub.egg-info/PKG-INFO +1 -1
  7. {phub-4.8.4 → phub-4.8.6}/LICENSE +0 -0
  8. {phub-4.8.4 → phub-4.8.6}/README.md +0 -0
  9. {phub-4.8.4 → phub-4.8.6}/pypi.md +0 -0
  10. {phub-4.8.4 → phub-4.8.6}/setup.cfg +0 -0
  11. {phub-4.8.4 → phub-4.8.6}/setup.py +0 -0
  12. {phub-4.8.4 → phub-4.8.6}/src/phub/__init__.py +0 -0
  13. {phub-4.8.4 → phub-4.8.6}/src/phub/__main__.py +0 -0
  14. {phub-4.8.4 → phub-4.8.6}/src/phub/consts.py +0 -0
  15. {phub-4.8.4 → phub-4.8.6}/src/phub/errors.py +0 -0
  16. {phub-4.8.4 → phub-4.8.6}/src/phub/literals.py +0 -0
  17. {phub-4.8.4 → phub-4.8.6}/src/phub/modules/__init__.py +0 -0
  18. {phub-4.8.4 → phub-4.8.6}/src/phub/modules/display.py +0 -0
  19. {phub-4.8.4 → phub-4.8.6}/src/phub/modules/rss.py +0 -0
  20. {phub-4.8.4 → phub-4.8.6}/src/phub/objects/__init__.py +0 -0
  21. {phub-4.8.4 → phub-4.8.6}/src/phub/objects/account.py +0 -0
  22. {phub-4.8.4 → phub-4.8.6}/src/phub/objects/data.py +0 -0
  23. {phub-4.8.4 → phub-4.8.6}/src/phub/objects/feed.py +0 -0
  24. {phub-4.8.4 → phub-4.8.6}/src/phub/objects/image.py +0 -0
  25. {phub-4.8.4 → phub-4.8.6}/src/phub/objects/playlist.py +0 -0
  26. {phub-4.8.4 → phub-4.8.6}/src/phub/objects/user.py +0 -0
  27. {phub-4.8.4 → phub-4.8.6}/src/phub/objects/video.py +0 -0
  28. {phub-4.8.4 → phub-4.8.6}/src/phub/tests/__init__.py +0 -0
  29. {phub-4.8.4 → phub-4.8.6}/src/phub/tests/test_auth.py +0 -0
  30. {phub-4.8.4 → phub-4.8.6}/src/phub/tests/test_model.py +0 -0
  31. {phub-4.8.4 → phub-4.8.6}/src/phub/tests/test_playlist.py +0 -0
  32. {phub-4.8.4 → phub-4.8.6}/src/phub/tests/test_search.py +0 -0
  33. {phub-4.8.4 → phub-4.8.6}/src/phub/tests/test_video.py +0 -0
  34. {phub-4.8.4 → phub-4.8.6}/src/phub/utils.py +0 -0
  35. {phub-4.8.4 → phub-4.8.6}/src/phub.egg-info/SOURCES.txt +0 -0
  36. {phub-4.8.4 → phub-4.8.6}/src/phub.egg-info/dependency_links.txt +0 -0
  37. {phub-4.8.4 → phub-4.8.6}/src/phub.egg-info/entry_points.txt +0 -0
  38. {phub-4.8.4 → phub-4.8.6}/src/phub.egg-info/requires.txt +0 -0
  39. {phub-4.8.4 → phub-4.8.6}/src/phub.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: phub
3
- Version: 4.8.4
3
+ Version: 4.8.6
4
4
  Summary: An API for Pornhub
5
5
  Author-email: Egsagon <egsagon.git@gmail.com>, EchterAlsFake <EchterAlsFake@proton.me>
6
6
  License: GNU GENERAL PUBLIC LICENSE
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "phub"
3
- version = "4.8.4"
3
+ version = "4.8.6"
4
4
  description = "An API for Pornhub"
5
5
  authors = [
6
6
  {name = 'Egsagon', email = "egsagon.git@gmail.com"},
@@ -61,7 +61,7 @@ class Client:
61
61
  self.core = core or BaseCore(config=RuntimeConfig())
62
62
  self.core.initialize_session()
63
63
  self.core.session.headers.update(consts.HEADERS)
64
- self.core.session.cookies.update(consts.HEADERS)
64
+ self.core.session.cookies.update(consts.COOKIES)
65
65
  # Applying PornHub specific cookies and headers to base API
66
66
  self.logger.debug('Initialised new Client %s', self)
67
67
 
@@ -361,7 +361,7 @@ class Client:
361
361
  AssertioneError: If one or more filters don't match their literals.
362
362
  '''
363
363
 
364
- query = query.strip()
364
+ query = query.strip().lower()
365
365
 
366
366
  assert query, 'Query must be a non-empty string'
367
367
 
@@ -370,7 +370,7 @@ class Client:
370
370
  literals.ass('exclude_category', exclude_category, literals.category )
371
371
  literals.ass('sort' , sort , literals.sort )
372
372
  literals.ass('period' , period , literals.period )
373
-
373
+ s = f'search "{query}"'
374
374
  return queries.VideoQuery(
375
375
  client = self,
376
376
  func = 'video/search',
@@ -383,8 +383,7 @@ class Client:
383
383
  't': literals.map.period.get(period),
384
384
  'hd': literals._craft_boolean(hd)
385
385
  },
386
- query_repr = query
387
- )
386
+ query_repr = s)
388
387
 
389
388
  def get_playlist(self, playlist: Union[str, int, Playlist]) -> Playlist:
390
389
  '''
@@ -80,6 +80,6 @@ def challenge(client: Client, challenge: str, token: str) -> None:
80
80
  # Build and inject cookie
81
81
  cookie = f'{n}*{p // n}:{s}:{token}:1'
82
82
  client.core.config.cookies = {'KEY': cookie}
83
- client.core.update_cookies()
83
+ client.core.session.cookies.update({'KEY': cookie})
84
84
  logger.info('Injected cookie %s', cookie)
85
85
  # EOF
@@ -5,6 +5,7 @@ import logging
5
5
  from base_api.base import setup_logger
6
6
  from functools import cache, cached_property
7
7
  from typing import TYPE_CHECKING, Iterator, Any, Callable, Union
8
+ from urllib.parse import urlencode, urlsplit, parse_qsl, urlunsplit
8
9
 
9
10
  from . import Video, User, FeedItem
10
11
 
@@ -93,7 +94,6 @@ class Query:
93
94
  self._query_repr = query_repr
94
95
 
95
96
  # Build URL
96
- args |= {'page': '{page}'}
97
97
  self.url = utils.concat(self.BASE, func, utils.urlify(args))
98
98
 
99
99
  self.suppress_spicevids = True
@@ -181,14 +181,17 @@ class Query:
181
181
  Returns:
182
182
  str: The raw page content.
183
183
  '''
184
-
184
+
185
185
  assert isinstance(index, int)
186
- url = self.url.format(page = index + 1)
186
+ parts = list(urlsplit(self.url))
187
+ q = dict(parse_qsl(parts[3], keep_blank_values=True))
188
+ q['page'] = str(index + 1) # PH uses 1-based pages; omit or set "1" for page 1
189
+ parts[3] = urlencode(q)
190
+ url = urlunsplit(parts)
191
+
187
192
  req = self.client.call(url, get_response=True, throw=False)
188
-
189
193
  if req.status_code == 404:
190
194
  raise errors.NoResult()
191
-
192
195
  return req.text
193
196
 
194
197
  @cache
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: phub
3
- Version: 4.8.4
3
+ Version: 4.8.6
4
4
  Summary: An API for Pornhub
5
5
  Author-email: Egsagon <egsagon.git@gmail.com>, EchterAlsFake <EchterAlsFake@proton.me>
6
6
  License: GNU GENERAL PUBLIC LICENSE
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes