phub 4.8.5__tar.gz → 4.8.7__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.
- {phub-4.8.5 → phub-4.8.7}/PKG-INFO +1 -1
- {phub-4.8.5 → phub-4.8.7}/README.md +1 -1
- {phub-4.8.5 → phub-4.8.7}/pyproject.toml +1 -1
- {phub-4.8.5 → phub-4.8.7}/src/phub/consts.py +1 -1
- {phub-4.8.5 → phub-4.8.7}/src/phub/core.py +6 -1
- {phub-4.8.5 → phub-4.8.7}/src/phub/modules/parser.py +1 -1
- {phub-4.8.5 → phub-4.8.7}/src/phub/objects/video.py +19 -7
- {phub-4.8.5 → phub-4.8.7}/src/phub.egg-info/PKG-INFO +1 -1
- {phub-4.8.5 → phub-4.8.7}/LICENSE +0 -0
- {phub-4.8.5 → phub-4.8.7}/pypi.md +0 -0
- {phub-4.8.5 → phub-4.8.7}/setup.cfg +0 -0
- {phub-4.8.5 → phub-4.8.7}/setup.py +0 -0
- {phub-4.8.5 → phub-4.8.7}/src/phub/__init__.py +0 -0
- {phub-4.8.5 → phub-4.8.7}/src/phub/__main__.py +0 -0
- {phub-4.8.5 → phub-4.8.7}/src/phub/errors.py +0 -0
- {phub-4.8.5 → phub-4.8.7}/src/phub/literals.py +0 -0
- {phub-4.8.5 → phub-4.8.7}/src/phub/modules/__init__.py +0 -0
- {phub-4.8.5 → phub-4.8.7}/src/phub/modules/display.py +0 -0
- {phub-4.8.5 → phub-4.8.7}/src/phub/modules/rss.py +0 -0
- {phub-4.8.5 → phub-4.8.7}/src/phub/objects/__init__.py +0 -0
- {phub-4.8.5 → phub-4.8.7}/src/phub/objects/account.py +0 -0
- {phub-4.8.5 → phub-4.8.7}/src/phub/objects/data.py +0 -0
- {phub-4.8.5 → phub-4.8.7}/src/phub/objects/feed.py +0 -0
- {phub-4.8.5 → phub-4.8.7}/src/phub/objects/image.py +0 -0
- {phub-4.8.5 → phub-4.8.7}/src/phub/objects/playlist.py +0 -0
- {phub-4.8.5 → phub-4.8.7}/src/phub/objects/query.py +0 -0
- {phub-4.8.5 → phub-4.8.7}/src/phub/objects/user.py +0 -0
- {phub-4.8.5 → phub-4.8.7}/src/phub/tests/__init__.py +0 -0
- {phub-4.8.5 → phub-4.8.7}/src/phub/tests/test_auth.py +0 -0
- {phub-4.8.5 → phub-4.8.7}/src/phub/tests/test_model.py +0 -0
- {phub-4.8.5 → phub-4.8.7}/src/phub/tests/test_playlist.py +0 -0
- {phub-4.8.5 → phub-4.8.7}/src/phub/tests/test_search.py +0 -0
- {phub-4.8.5 → phub-4.8.7}/src/phub/tests/test_video.py +0 -0
- {phub-4.8.5 → phub-4.8.7}/src/phub/utils.py +0 -0
- {phub-4.8.5 → phub-4.8.7}/src/phub.egg-info/SOURCES.txt +0 -0
- {phub-4.8.5 → phub-4.8.7}/src/phub.egg-info/dependency_links.txt +0 -0
- {phub-4.8.5 → phub-4.8.7}/src/phub.egg-info/entry_points.txt +0 -0
- {phub-4.8.5 → phub-4.8.7}/src/phub.egg-info/requires.txt +0 -0
- {phub-4.8.5 → phub-4.8.7}/src/phub.egg-info/top_level.txt +0 -0
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<div align="center">
|
|
6
6
|
<a href="https://pepy.tech/project/phub"><img src="https://static.pepy.tech/badge/phub" alt="Downloads"></a>
|
|
7
7
|
<a href="https://badge.fury.io/py/phub"><img src="https://badge.fury.io/py/phub.svg" alt="PyPI version" height="18"></a>
|
|
8
|
-
<a href="https://
|
|
8
|
+
<a href="https://echteralsfake.duckdns.org/ci/PHUB/badge.svg"><img src="https://echteralsfake.duckdns.org/ci/PHUB/badge.svg" alt="API Tests"/></a>
|
|
9
9
|
</div>
|
|
10
10
|
|
|
11
11
|
<br>
|
|
@@ -227,7 +227,7 @@ class re:
|
|
|
227
227
|
container = find( engine.DOTALL, r'class=\"container(.*)' ) # Get the page container
|
|
228
228
|
document = find( engine.DOTALL, r'.*' ) # Match a whole document
|
|
229
229
|
get_playlist_unavailable = find( engine.DOTALL, r': (\d+)</h5' ) # Get playlist unavailable videos amount
|
|
230
|
-
get_playlist_size = find( engine.DOTALL, r'var itemsCount = (.*?) ||'
|
|
230
|
+
get_playlist_size = find( engine.DOTALL, r'var itemsCount = (.*?) ||' ) # Get playlist video amount
|
|
231
231
|
get_playlist_likes = find( engine.DOTALL, r'<span class="votesUp">(.*?)</span>' ) # Get playlist likes
|
|
232
232
|
get_playlist_dislikes = find( engine.DOTALL, r'<span class="votesDown">(.*?)</span>' ) # Get playlist dislikes
|
|
233
233
|
get_playlist_ratings = find( engine.DOTALL, r'<span class="percent">(.*?)%</span>' ) # Get paylist like/dislike ratio
|
|
@@ -5,6 +5,8 @@ import re
|
|
|
5
5
|
import time
|
|
6
6
|
import logging
|
|
7
7
|
import random
|
|
8
|
+
import traceback
|
|
9
|
+
|
|
8
10
|
import httpx
|
|
9
11
|
|
|
10
12
|
from functools import cached_property
|
|
@@ -61,7 +63,7 @@ class Client:
|
|
|
61
63
|
self.core = core or BaseCore(config=RuntimeConfig())
|
|
62
64
|
self.core.initialize_session()
|
|
63
65
|
self.core.session.headers.update(consts.HEADERS)
|
|
64
|
-
self.core.session.cookies.update(consts.
|
|
66
|
+
self.core.session.cookies.update(consts.COOKIES)
|
|
65
67
|
# Applying PornHub specific cookies and headers to base API
|
|
66
68
|
self.logger.debug('Initialised new Client %s', self)
|
|
67
69
|
|
|
@@ -117,6 +119,7 @@ class Client:
|
|
|
117
119
|
headers: dict = None,
|
|
118
120
|
throw: bool = True,
|
|
119
121
|
silent: bool = False,
|
|
122
|
+
params: dict = None,
|
|
120
123
|
get_response = True) -> httpx.Response:
|
|
121
124
|
'''
|
|
122
125
|
Used internally to send a request or an API call.
|
|
@@ -156,6 +159,7 @@ class Client:
|
|
|
156
159
|
method = method,
|
|
157
160
|
url = url,
|
|
158
161
|
data = data,
|
|
162
|
+
params = params,
|
|
159
163
|
get_response=get_response)
|
|
160
164
|
|
|
161
165
|
# Silent 429 errors
|
|
@@ -175,6 +179,7 @@ class Client:
|
|
|
175
179
|
break
|
|
176
180
|
|
|
177
181
|
except Exception as err:
|
|
182
|
+
print(traceback.format_exc())
|
|
178
183
|
self.logger.log(logging.DEBUG if silent else logging.WARNING,
|
|
179
184
|
f'Call failed: {repr(err)}. Retrying (attempt {i + 1}/{self.core.config.max_retries})')
|
|
180
185
|
continue
|
|
@@ -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.
|
|
83
|
+
client.core.session.cookies.update({'KEY': cookie})
|
|
84
84
|
logger.info('Injected cookie %s', cookie)
|
|
85
85
|
# EOF
|
|
@@ -5,10 +5,14 @@ import os
|
|
|
5
5
|
import random
|
|
6
6
|
import logging
|
|
7
7
|
from functools import cached_property
|
|
8
|
+
|
|
9
|
+
import httpx
|
|
8
10
|
from base_api.base import setup_logger
|
|
9
11
|
from datetime import datetime, timedelta
|
|
10
12
|
from typing import TYPE_CHECKING, Iterator, Literal, Callable, Any, Union
|
|
11
13
|
|
|
14
|
+
from httpx import request
|
|
15
|
+
|
|
12
16
|
from . import Tag, Like, User, Image
|
|
13
17
|
from .. import utils
|
|
14
18
|
from .. import errors
|
|
@@ -383,7 +387,7 @@ class Video:
|
|
|
383
387
|
|
|
384
388
|
self._assert_internal_success(res.json())
|
|
385
389
|
|
|
386
|
-
def watch_later(self, toggle: bool = True) ->
|
|
390
|
+
def watch_later(self, toggle: bool = True) -> bool:
|
|
387
391
|
'''
|
|
388
392
|
Add or remove the video to the watch later playlist.
|
|
389
393
|
|
|
@@ -391,14 +395,22 @@ class Video:
|
|
|
391
395
|
toggle (bool): The toggle value.
|
|
392
396
|
'''
|
|
393
397
|
|
|
394
|
-
|
|
398
|
+
if toggle:
|
|
399
|
+
res = self.client.call(f'api/v1/playlist/video_add_watchlater', 'POST', dict(
|
|
400
|
+
vid=self.id,
|
|
401
|
+
token=self.client._granted_token
|
|
402
|
+
))
|
|
403
|
+
return res.is_success
|
|
395
404
|
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
405
|
+
else:
|
|
406
|
+
res = self.client.call(
|
|
407
|
+
"api/v1/playlist/video_remove_watchlater",
|
|
408
|
+
method="DELETE",
|
|
409
|
+
params={"vid": str(self.id), "token": str(self.client._granted_token)},
|
|
410
|
+
headers={"Accept": "application/json"},
|
|
411
|
+
)
|
|
412
|
+
return res.is_success
|
|
400
413
|
|
|
401
|
-
self._assert_internal_success(res.json())
|
|
402
414
|
|
|
403
415
|
# === Data properties === #
|
|
404
416
|
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|