Direct link generator: Add racaty support again

This commit is contained in:
4amparaboy 2021-07-19 03:40:55 +07:00 committed by GitHub
parent 211d799342
commit c884bda61c
Signed by untrusted user: GitHub
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 1 deletions

View File

@ -18,7 +18,7 @@ from random import choice
from urllib.parse import urlparse
import lk21
import requests
import requests, cfscrape
from bs4 import BeautifulSoup
from js2py import EvalJs
from lk21.extractors.bypasser import Bypass
@ -87,6 +87,8 @@ def direct_link_generator(link: str):
return streamtape(link)
elif 'bayfiles.com' in link:
return anonfiles(link)
elif 'racaty.net' in link:
return racaty(link)
else:
raise DirectDownloadLinkException(f'No Direct link function found for {link}')
@ -317,6 +319,23 @@ def streamtape(url: str) -> str:
dl_url=bypasser.bypass_streamtape(url)
return dl_url
def racaty(url: str) -> str:
""" Racaty direct links generator
based on https://github.com/breakdowns/slam-mirrorbot """
dl_url = ''
try:
link = re.findall(r'\bhttps?://.*racaty\.net\S+', url)[0]
except IndexError:
raise DirectDownloadLinkException("`No Racaty links found`\n")
scraper = cfscrape.create_scraper()
r = scraper.get(url)
soup = BeautifulSoup(r.text, "lxml")
op = soup.find("input", {"name": "op"})["value"]
ids = soup.find("input", {"name": "id"})["value"]
rpost = scraper.post(url, data = {"op": op, "id": ids})
rsoup = BeautifulSoup(rpost.text, "lxml")
dl_url = rsoup.find("a", {"id": "uniqueExpirylink"})["href"].replace(" ", "%20")
return dl_url
def useragent():
"""

View File

@ -2,6 +2,7 @@ aiohttp
aria2p
appdirs
beautifulsoup4
cloudscrape==0.4.2
feedparser
gitpython
google-api-python-client