Skip to content

Commit 8e574e7

Browse files
committed
- fixed download error
- release 1.9.0
1 parent c0c2e9e commit 8e574e7

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

eporner_api/eporner_api.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -334,18 +334,23 @@ def direct_download_link(self, quality, mode) -> str:
334334
self.logger.error(f"Using direct donwload Link: {str(url)}")
335335
return urljoin("https://eporner.com", str(url))
336336

337-
def download(self, quality, path, callback=None, mode=Encoding.mp4_h264, no_title=False):
337+
def download(self, quality, path, callback=None, mode=Encoding.mp4_h264, no_title=False, use_workaround=False):
338338
if not self.enable_html:
339339
raise HTML_IS_DISABLED("HTML content is disabled! See Documentation for more details")
340340

341-
response_redirect_url = self.core.fetch(self.direct_download_link(quality, mode),
342-
allow_redirects=True, get_response=True)
343-
344341
if no_title is False:
345342
path = os.path.join(path, f"{self.title}.mp4")
346343

344+
345+
url = self.direct_download_link(quality, mode)
346+
if use_workaround:
347+
response_redirect_url = self.core.fetch(self.direct_download_link(quality, mode),
348+
allow_redirects=True, get_response=True) # Sometimes the site trolls me
349+
350+
url = response_redirect_url.url
351+
347352
try:
348-
self.core.legacy_download(url=str(response_redirect_url.url), callback=callback, path=path)
353+
self.core.legacy_download(url=url, callback=callback, path=path)
349354
return True
350355

351356
except Exception:

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "Eporner_API"
7-
version = "1.8.9"
7+
version = "1.9.0"
88
description = "A Python API for the Porn Site Eporner.com"
99
readme = "README.md"
1010
requires-python = ">=3.6"

0 commit comments

Comments
 (0)