Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for streamtape and krakenfiles #270

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 19 additions & 12 deletions bot/helper/mirror_utils/download_utils/direct_link_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,10 @@ def streamtape(url):
html = HTML(session.get(url).text)
except Exception as e:
raise DirectDownloadLinkException(f"ERROR: {e.__class__.__name__}") from e
if not (script := html.xpath("//script[contains(text(),'ideoooolink')]/text()")):
script = html.xpath(
"//script[contains(text(),'ideoooolink')]/text()"
) or html.xpath("//script[contains(text(),'ideoolink')]/text()")
if not script:
raise DirectDownloadLinkException("ERROR: requeries script not found")
if not (link := findall(r"(&expires\S+)'", script[0])):
raise DirectDownloadLinkException("ERROR: Download link not found")
Expand Down Expand Up @@ -555,23 +558,27 @@ def krakenfiles(url):
try:
_res = session.get(url)
except Exception as e:
raise DirectDownloadLinkException(f'ERROR: {e.__class__.__name__}') from e
raise DirectDownloadLinkException(f"ERROR: {e.__class__.__name__}") from e
html = HTML(_res.text)
if post_url:= html.xpath('//form[@id="dl-form"]/@action'):
post_url = f'https:{post_url[0]}'
if post_url := html.xpath('//form[@id="dl-form"]/@action'):
post_url = f"https://krakenfiles.com{post_url[0]}"
else:
raise DirectDownloadLinkException('ERROR: Unable to find post link.')
if token:= html.xpath('//input[@id="dl-token"]/@value'):
data = {'token': token[0]}
raise DirectDownloadLinkException("ERROR: Unable to find post link.")
if token := html.xpath('//input[@id="dl-token"]/@value'):
data = {"token": token[0]}
else:
raise DirectDownloadLinkException('ERROR: Unable to find token for post.')
raise DirectDownloadLinkException("ERROR: Unable to find token for post.")
try:
_json = session.post(post_url, data=data).json()
except Exception as e:
raise DirectDownloadLinkException(f'ERROR: {e.__class__.__name__} While send post request') from e
if _json['status'] != 'ok':
raise DirectDownloadLinkException("ERROR: Unable to find download after post request")
return _json['url']
raise DirectDownloadLinkException(
f"ERROR: {e.__class__.__name__} While send post request"
) from e
if _json["status"] != "ok":
raise DirectDownloadLinkException(
"ERROR: Unable to find download after post request"
)
return _json["url"]



Expand Down