From f22266e5c726b7081d8d6dd711b68804b53bf463 Mon Sep 17 00:00:00 2001 From: speedyconzales <9094731+speedyconzales@users.noreply.github.com> Date: Sun, 8 Dec 2024 10:38:16 +0100 Subject: [PATCH] adds SpeedFiles as provider (#41) --- README.md | 3 ++- main.py | 2 +- src/argument_parser.py | 2 +- src/html_scraper.py | 19 ++++++++++++++++++- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index be8e4ca..046f7e2 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ headless and completely automated scraping of the following sites: - [Doodstream](https://doodstream.com) - [Streamtape](https://streamtape.com) - [Vidmoly](https://vidmoly.to) +- [SpeedFiles](https://speedfiles.net) ## Usage * If you are familiar with docker @@ -97,7 +98,7 @@ headless and completely automated scraping of the following sites: | `-s, --season` | **Default:** All seasons will be scraped but not the movies or specials. Choose the season number. -> Providing `0` as season number scrapes the respective movies or specials of that series | | `-e, --episode` | **Default:** All episodes of the season will be scraped. Choose either one episode or a list of episodes separated by spaces. You can also specify a range of episodes e.g.: `-e 2 3 10-15 17` | | `-t, --threads` | **Default:** 2. Specify the number of threads or concurrent downloads. Do not choose too high numbers as the server might block too frequent requests | -| `-p, --provider` | **Default:** Downloads will follow this priority: Vidoza > VOE > Doodstream > Streamtape > Vidmoly. If the episode is not available on the hoster it will try the next. Specify the hoster/provider you want to download from | +| `-p, --provider` | **Default:** Downloads will follow this priority: Vidoza > VOE > Doodstream > Streamtape > Vidmoly > SpeedFiles. If the episode is not available on the hoster it will try the next. Specify the hoster/provider you want to download from | | `-a, --anime` | Declare this content as anime. Only useful for `bs.to` as it does not distinguish between series and anime on the site | ## Credits diff --git a/main.py b/main.py index 94a8809..f518e75 100644 --- a/main.py +++ b/main.py @@ -83,7 +83,7 @@ def main(): os.makedirs(output_path, exist_ok=True) - providers = ["Vidoza", "VOE", "Doodstream", "Streamtape", "Vidmoly"] if not provider else provider + providers = ["Vidoza", "VOE", "Doodstream", "Streamtape", "Vidmoly", "SpeedFiles"] if not provider else provider for season in seasons: season_path = f"{output_path}/Season {season:02}" diff --git a/src/argument_parser.py b/src/argument_parser.py index f59fb79..16bd0e2 100644 --- a/src/argument_parser.py +++ b/src/argument_parser.py @@ -37,7 +37,7 @@ def parse_range(episodes): parser.add_argument("-s", "--season", type=int, help="specify the season") parser.add_argument("-e", "--episode", nargs='+', type=str, help="specify a list of episode numbers") parser.add_argument("-t", "--threads", type=int, help="specify the number of threads or concurrent downloads") - parser.add_argument("-p", "--provider", choices=["VOE", "Vidoza", "Streamtape", "Doodstream", "Vidmoly"], help="Choose the hoster/provider you want to download from") + parser.add_argument("-p", "--provider", choices=["VOE", "Vidoza", "Streamtape", "Doodstream", "Vidmoly", "SpeedFiles"], help="Choose the hoster/provider you want to download from") parser.add_argument("-a", "--anime", action='store_true', help="specify if the content is an anime") args = parser.parse_args() diff --git a/src/html_scraper.py b/src/html_scraper.py index 1ad38b0..ee62a74 100644 --- a/src/html_scraper.py +++ b/src/html_scraper.py @@ -27,7 +27,7 @@ re.compile(r'prompt\("Node",\s*"(?P[^"]+)"')] STREAMTAPE_PATTERN = re.compile(r"get_video\?id=[^&\'\s]+&expires=[^&\'\s]+&ip=[^&\'\s]+&token=[^&\'\s]+\'") VIDMOLY_PATTERN = re.compile(r"sources: \[{file:\"(?P.*?)\"}]") - +SPEEDFILES_PATTERN = re.compile(r"var _0x5opu234 = \"(?P.*?)\";") def get_episode_link(url, language, provider, season, episode, burning_series): if burning_series: @@ -129,6 +129,23 @@ def find_content_url(url, provider): print(content_link) if content_link is None: logger.error(f"Failed to find the video link of provider Vidmoly") + elif provider == "SpeedFiles": + match = SPEEDFILES_PATTERN.search(decoded_html) + content = match.group("content") + content = b64decode(content).decode() + content = content.swapcase() + content = ''.join(reversed(content)) + content = b64decode(content).decode() + content = ''.join(reversed(content)) + next_content = "" + for i in range(0, len(content), 2): + next_content += chr(int(content[i:i + 2], 16)) + content_link = "" + for char in next_content: + content_link += chr(ord(char) - 3) + content_link = content_link.swapcase() + content_link = ''.join(reversed(content_link)) + content_link = b64decode(content_link).decode() logger.debug(f"Found the following video link of {provider}: {content_link}") return content_link