phub 4.8.2__tar.gz → 4.8.3__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.2 → phub-4.8.3}/PKG-INFO +1 -1
- {phub-4.8.2 → phub-4.8.3}/pyproject.toml +1 -1
- {phub-4.8.2 → phub-4.8.3}/src/phub/core.py +10 -11
- {phub-4.8.2 → phub-4.8.3}/src/phub/modules/display.py +1 -1
- {phub-4.8.2 → phub-4.8.3}/src/phub.egg-info/PKG-INFO +1 -1
- {phub-4.8.2 → phub-4.8.3}/LICENSE +0 -0
- {phub-4.8.2 → phub-4.8.3}/README.md +0 -0
- {phub-4.8.2 → phub-4.8.3}/pypi.md +0 -0
- {phub-4.8.2 → phub-4.8.3}/setup.cfg +0 -0
- {phub-4.8.2 → phub-4.8.3}/setup.py +0 -0
- {phub-4.8.2 → phub-4.8.3}/src/phub/__init__.py +0 -0
- {phub-4.8.2 → phub-4.8.3}/src/phub/__main__.py +0 -0
- {phub-4.8.2 → phub-4.8.3}/src/phub/consts.py +0 -0
- {phub-4.8.2 → phub-4.8.3}/src/phub/errors.py +0 -0
- {phub-4.8.2 → phub-4.8.3}/src/phub/literals.py +0 -0
- {phub-4.8.2 → phub-4.8.3}/src/phub/modules/__init__.py +0 -0
- {phub-4.8.2 → phub-4.8.3}/src/phub/modules/parser.py +0 -0
- {phub-4.8.2 → phub-4.8.3}/src/phub/modules/rss.py +0 -0
- {phub-4.8.2 → phub-4.8.3}/src/phub/objects/__init__.py +0 -0
- {phub-4.8.2 → phub-4.8.3}/src/phub/objects/account.py +0 -0
- {phub-4.8.2 → phub-4.8.3}/src/phub/objects/data.py +0 -0
- {phub-4.8.2 → phub-4.8.3}/src/phub/objects/feed.py +0 -0
- {phub-4.8.2 → phub-4.8.3}/src/phub/objects/image.py +0 -0
- {phub-4.8.2 → phub-4.8.3}/src/phub/objects/playlist.py +0 -0
- {phub-4.8.2 → phub-4.8.3}/src/phub/objects/query.py +0 -0
- {phub-4.8.2 → phub-4.8.3}/src/phub/objects/user.py +0 -0
- {phub-4.8.2 → phub-4.8.3}/src/phub/objects/video.py +0 -0
- {phub-4.8.2 → phub-4.8.3}/src/phub/tests/__init__.py +0 -0
- {phub-4.8.2 → phub-4.8.3}/src/phub/tests/test_auth.py +0 -0
- {phub-4.8.2 → phub-4.8.3}/src/phub/tests/test_model.py +0 -0
- {phub-4.8.2 → phub-4.8.3}/src/phub/tests/test_playlist.py +0 -0
- {phub-4.8.2 → phub-4.8.3}/src/phub/tests/test_search.py +0 -0
- {phub-4.8.2 → phub-4.8.3}/src/phub/tests/test_video.py +0 -0
- {phub-4.8.2 → phub-4.8.3}/src/phub/utils.py +0 -0
- {phub-4.8.2 → phub-4.8.3}/src/phub.egg-info/SOURCES.txt +0 -0
- {phub-4.8.2 → phub-4.8.3}/src/phub.egg-info/dependency_links.txt +0 -0
- {phub-4.8.2 → phub-4.8.3}/src/phub.egg-info/entry_points.txt +0 -0
- {phub-4.8.2 → phub-4.8.3}/src/phub.egg-info/requires.txt +0 -0
- {phub-4.8.2 → phub-4.8.3}/src/phub.egg-info/top_level.txt +0 -0
|
@@ -7,9 +7,10 @@ import logging
|
|
|
7
7
|
import random
|
|
8
8
|
import httpx
|
|
9
9
|
|
|
10
|
-
from typing import Iterable, Union
|
|
11
10
|
from functools import cached_property
|
|
11
|
+
from typing import Iterable, Union, Optional
|
|
12
12
|
from base_api.base import BaseCore, setup_logger
|
|
13
|
+
from base_api.modules.config import RuntimeConfig
|
|
13
14
|
|
|
14
15
|
from . import utils
|
|
15
16
|
from . import consts
|
|
@@ -39,7 +40,7 @@ class Client:
|
|
|
39
40
|
bypass_geo_blocking: bool = False,
|
|
40
41
|
change_title_language: bool = True,
|
|
41
42
|
use_webmaster_api: bool = True,
|
|
42
|
-
core=None) -> None:
|
|
43
|
+
core: Optional[BaseCore] = None) -> None:
|
|
43
44
|
'''
|
|
44
45
|
Initialises a new client.
|
|
45
46
|
|
|
@@ -57,9 +58,8 @@ class Client:
|
|
|
57
58
|
'''
|
|
58
59
|
|
|
59
60
|
self.logger = setup_logger(name="PHUB API - [Client]", log_file=None, level=logging.ERROR)
|
|
60
|
-
self.core = core or BaseCore()
|
|
61
|
-
self.core.
|
|
62
|
-
self.core.config.headers = consts.HEADERS
|
|
61
|
+
self.core = core or BaseCore(config=RuntimeConfig())
|
|
62
|
+
self.core.initialize_session(headers=consts.HEADERS, cookies=consts.COOKIES)
|
|
63
63
|
# Applying PornHub specific cookies and headers to base API
|
|
64
64
|
self.logger.debug('Initialised new Client %s', self)
|
|
65
65
|
|
|
@@ -71,8 +71,7 @@ class Client:
|
|
|
71
71
|
|
|
72
72
|
self.reset()
|
|
73
73
|
|
|
74
|
-
self.core.
|
|
75
|
-
self.core.update_headers({"Accept-Language": language})
|
|
74
|
+
self.core.session.headers.update({"Accept-Language": language})
|
|
76
75
|
self.credentials = {'email': email,
|
|
77
76
|
'password': password}
|
|
78
77
|
|
|
@@ -102,11 +101,11 @@ class Client:
|
|
|
102
101
|
language_code = "fr"
|
|
103
102
|
|
|
104
103
|
# Faking the X-Forwarded-For header (Fake IP source)
|
|
105
|
-
self.core.
|
|
104
|
+
self.core.session.headers.update({"X-Forwarded-For": f"{ip}"})
|
|
106
105
|
# Setting the Accept-Language tag to French, because the faked IP comes from france
|
|
107
|
-
self.core.
|
|
106
|
+
self.core.session.headers.update({"Accept-Language": f"{language_code}"})
|
|
108
107
|
# Setting the country code also to french
|
|
109
|
-
self.core.
|
|
108
|
+
self.core.session.headers.update({"CF-IPCountry": f"{language_code}"})
|
|
110
109
|
logging.debug(f"Using faked headers for geo-bypass: {self.core.config.session.headers}")
|
|
111
110
|
|
|
112
111
|
def call(self,
|
|
@@ -139,7 +138,7 @@ class Client:
|
|
|
139
138
|
self.logger.log(logging.DEBUG if silent else logging.INFO, 'Fetching %s', func or '/')
|
|
140
139
|
|
|
141
140
|
if headers:
|
|
142
|
-
self.core.
|
|
141
|
+
self.core.session.headers = headers
|
|
143
142
|
|
|
144
143
|
if not self.language == "en":
|
|
145
144
|
host = consts.LANGUAGE_MAPPING.get(self.language)
|
|
@@ -20,7 +20,7 @@ def progress(color: Union[dict, None] = dict(c1=30, c2=33, c3=34, c4=36), desc:
|
|
|
20
20
|
color['c0'] = 0
|
|
21
21
|
color = {k: '' if v == '' else f'\033[{v}m' for k, v in color.items()}
|
|
22
22
|
|
|
23
|
-
tem = '\r{c1}' + desc + ' {c2}{percent}%{c0} - {c3}{cur}{c0}/{c3}{total}
|
|
23
|
+
tem = '\r{c1}' + desc + ' {c2}{percent}%{c0} - {c3}{cur}{c0}/{c3}{total}{c0}' # ({c4}{speed}ips{c0})
|
|
24
24
|
done = False
|
|
25
25
|
start = time.time()
|
|
26
26
|
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|