phub 4.8.1__py3-none-any.whl → 4.8.3__py3-none-any.whl
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/core.py +10 -11
- phub/modules/display.py +1 -1
- phub/objects/video.py +7 -1
- {phub-4.8.1.dist-info → phub-4.8.3.dist-info}/METADATA +1 -1
- {phub-4.8.1.dist-info → phub-4.8.3.dist-info}/RECORD +9 -9
- {phub-4.8.1.dist-info → phub-4.8.3.dist-info}/WHEEL +0 -0
- {phub-4.8.1.dist-info → phub-4.8.3.dist-info}/entry_points.txt +0 -0
- {phub-4.8.1.dist-info → phub-4.8.3.dist-info}/licenses/LICENSE +0 -0
- {phub-4.8.1.dist-info → phub-4.8.3.dist-info}/top_level.txt +0 -0
phub/core.py
CHANGED
|
@@ -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)
|
phub/modules/display.py
CHANGED
|
@@ -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
|
|
phub/objects/video.py
CHANGED
|
@@ -218,9 +218,15 @@ class Video:
|
|
|
218
218
|
except Exception as e:
|
|
219
219
|
self.logger.warning(f"Skipping invalid quality entry: {q}, {e}")
|
|
220
220
|
continue
|
|
221
|
-
|
|
222
221
|
return quality_urls
|
|
223
222
|
|
|
223
|
+
def get_segments(self, quality) -> list:
|
|
224
|
+
"""
|
|
225
|
+
:param quality: (str) The video quality
|
|
226
|
+
:return: (list) A list of segments (URLs)
|
|
227
|
+
"""
|
|
228
|
+
segments = self.client.core.get_segments(m3u8_url_master=self.m3u8_base_url, quality=quality)
|
|
229
|
+
return segments
|
|
224
230
|
|
|
225
231
|
def download(self,
|
|
226
232
|
path: Union[str, os.PathLike],
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
phub/__init__.py,sha256=tEWpP7XSkDB9_M5iJ1XHSgpJ6g4olWqYTX8f9IBpIAA,635
|
|
2
2
|
phub/__main__.py,sha256=rRph6K-lXFURL7t8s0q_XB5-4Bqtrkg_ZoERjhjNmow,3637
|
|
3
3
|
phub/consts.py,sha256=a-okcZtwtSDmt4eub_acE1xWg1Fqxm1DZ9yy7aVGvM0,12453
|
|
4
|
-
phub/core.py,sha256=
|
|
4
|
+
phub/core.py,sha256=GNvtpyJZO-97kzb1PCcyQrIL9SeUgIIZAks_BtekuoQ,18355
|
|
5
5
|
phub/errors.py,sha256=KiNt_4T4ffzgL-2iIfD8qhIHN_5DeKV4FLPcY72sOw8,1822
|
|
6
6
|
phub/literals.py,sha256=ZnRnn5hJNI3hM6aj2YxsxPANUR-PCqfE2SuQGD8_Yq4,10794
|
|
7
7
|
phub/utils.py,sha256=MYPYvpLrWAYXcwpSUJnRWvFNP0N9iOyLxkzaJFsk8GA,6582
|
|
8
8
|
phub/modules/__init__.py,sha256=h8BQjvxnqCEXxDCn7iDvnGLv0ZF_lE0dFlI7HVkzN5A,133
|
|
9
|
-
phub/modules/display.py,sha256=
|
|
9
|
+
phub/modules/display.py,sha256=qOUaDGZJbGp80JAqPu_T__F2Mzwr3FBRnhrAdYdVjoE,2444
|
|
10
10
|
phub/modules/parser.py,sha256=v2iDYAZB6VQ6KvKR_Oe1Cs5Du42W0yNFvtliJKxbZdI,2337
|
|
11
11
|
phub/modules/rss.py,sha256=j666dZenn3tWgLVXd2U3ox2-tWyUynFXuArzG2bmOFc,980
|
|
12
12
|
phub/objects/__init__.py,sha256=BHOythbS-r01YKYSxtExBlJZYF38hkp85aLAoVQfDd4,446
|
|
@@ -17,16 +17,16 @@ phub/objects/image.py,sha256=qCLuaOy-EYzA_uXxiPRQeCLHPf9gFr0o7TDszQvWXZs,3376
|
|
|
17
17
|
phub/objects/playlist.py,sha256=hpP76yH23LdDS0iL28jhp_iG7EGetYJA3xoqZZdXjTs,3278
|
|
18
18
|
phub/objects/query.py,sha256=crYC-MJGEf04XO3hfU7FPyyHEnBWS9D8XbeQmtTnpzQ,11596
|
|
19
19
|
phub/objects/user.py,sha256=pIumIGC_MQXQ-hjzf_0c0I_egL4WziHrh2e8XegArEc,8161
|
|
20
|
-
phub/objects/video.py,sha256=
|
|
20
|
+
phub/objects/video.py,sha256=NgsfxgqwjkiTKcNLEgwfMLfeGU7n2j4ZF3Vkq4LocR0,19168
|
|
21
21
|
phub/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
22
|
phub/tests/test_auth.py,sha256=ySy1Aw0bogMGDSTmzVXO_W352cbRFzXUGjuDX1Iu0xE,609
|
|
23
23
|
phub/tests/test_model.py,sha256=hRpmIjsx2z0EjTWsIpwT_vpHm-H4wCmZtvGWOohaIKQ,1426
|
|
24
24
|
phub/tests/test_playlist.py,sha256=-hS5bIBecsv3zSNlUo66b73DdVbkYlmVThYip9Ivpss,1081
|
|
25
25
|
phub/tests/test_search.py,sha256=VeqyjVzu0QnIYR6NhcujXy8wfCcWn1BlvKS06iY-7JY,1301
|
|
26
26
|
phub/tests/test_video.py,sha256=4E70tiza45byMFIrjBdnpP3xOSyk1YKoTGNP4_QTI0E,1465
|
|
27
|
-
phub-4.8.
|
|
28
|
-
phub-4.8.
|
|
29
|
-
phub-4.8.
|
|
30
|
-
phub-4.8.
|
|
31
|
-
phub-4.8.
|
|
32
|
-
phub-4.8.
|
|
27
|
+
phub-4.8.3.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
|
28
|
+
phub-4.8.3.dist-info/METADATA,sha256=UQhMlCnYYg3sTI6MjcKJIR2ZF8F4f4LYV3NHgAJmblU,41740
|
|
29
|
+
phub-4.8.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
30
|
+
phub-4.8.3.dist-info/entry_points.txt,sha256=oxL1BvDV19M1IGLgwFElgb37PlmGnblDBEfMwx3x6u8,44
|
|
31
|
+
phub-4.8.3.dist-info/top_level.txt,sha256=xqJ5Lg28Ba-pgvXf8qwpTFurW3neZhguNd8bhbQonZo,5
|
|
32
|
+
phub-4.8.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|