diff --git a/README.md b/README.md index 8227d14..50aae9b 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,6 @@ Yeah. Me too! That's why this tool exists. - Dbanimes - EraiRaws - EgyAnime - usually m3u8 (good for streaming, not so much for downloading) -- FastAni - GenoAnime - GurminderBoparai (AnimeChameleon) - itsaturday diff --git a/anime_downloader/sites/fastani.py b/anime_downloader/sites/fastani.py deleted file mode 100644 index dcb013a..0000000 --- a/anime_downloader/sites/fastani.py +++ /dev/null @@ -1,80 +0,0 @@ -from anime_downloader.sites.anime import Anime, AnimeEpisode, SearchResult -from anime_downloader.sites import helpers -import re -import logging - -logger = logging.getLogger(__name__) - - -class FastAni(Anime, sitename="fastani"): - - sitename = 'fastani' - - @classmethod - def getToken(cls): - resp = helpers.get("https://fastani.net") - site_text = resp.text - cookies = resp.cookies - - # Path to js file, e.g /static/js/main.f450dd1c.chunk.js - which contains the token - js_location = "https://fastani.net" + re.search(r"src=\"(\/static\/js\/main.*?)\"", site_text).group(1) - js = helpers.get(js_location).text - - # Get authorization token, e.g: {authorization:"Bearer h8X2exbErErNSxRnr6sSXAE2ycUSyrbU"} - key, token = re.search("method:\"GET\".*?\"(.*?)\".*?\"(.*?)\"", js).group(1,2) - - return ({key: token}, cookies) - - @classmethod - def search(cls, query): - headers, cookies = cls.getToken() - results = helpers.get(f"https://fastani.net/api/data?page=1&search={query}&tags=&years=", headers=headers, cookies=cookies).json() - - return [ - SearchResult( - title=x.get('title').get("english"), - # Need to know selected anime and original query for _scrape_episodes - url=f"https://fastani.net/{selected}/{query}" - ) - for selected, x in zip(range(len(results["animeData"]["cards"])), results["animeData"]["cards"]) - ] - - def _scrape_episodes(self): - headers, cookies = self.getToken() - split = self.url.split("/") - query, selected = split[-1], int(split[-2]) - anime = helpers.get(f"https://fastani.net/api/data?page=1&search={query}&tags=&years=", headers=headers, cookies=cookies).json() - - cdnData = anime["animeData"]["cards"][selected]["cdnData"] - - # Get all episodes from all seasons of the anime - # JSON Example: - """ - { - 'seasons': [{ - 'episodes': [{ - 'file': 'https://private.fastani.net/Naruto/Season 1/Naruto S01E001.mp4', - 'directory': 'https://private.fastani.net/Naruto/Season 1', - 'timestamp': '2020-09-11T16:22:48.744Z', - 'thumb': 'https://private.fastani.net/Naruto/Season 1/thumbs/20_thumbnail_001.jpg', - 'title': 'Enter: Naruto Uzumaki!' - } - ... - ] - } - """ - episodes = [j["file"] for i in [x["episodes"] for x in cdnData["seasons"]] for j in i] - - return episodes - - def _scrape_metadata(self): - headers, cookies = self.getToken() - split = self.url.split("/") - query, selected = split[-1], int(split[-2]) - anime = helpers.get(f"https://fastani.net/api/data?page=1&search={query}&tags=&years=", headers=headers, cookies=cookies).json() - self.title = anime["animeData"]["cards"][selected]["title"]["english"] - - -class FastAniEpisode(AnimeEpisode, sitename='fastani'): - def _get_sources(self): - return [("no_extractor", self.url)] diff --git a/anime_downloader/sites/init.py b/anime_downloader/sites/init.py index 1030e95..6577051 100644 --- a/anime_downloader/sites/init.py +++ b/anime_downloader/sites/init.py @@ -26,7 +26,6 @@ ALL_ANIME_SITES = [ ('dbanimes', 'dbanimes', 'DBAnimes'), ('erairaws', 'erai-raws', 'EraiRaws'), ('egyanime', 'egyanime', 'EgyAnime'), - ('fastani', 'fastani', 'FastAni'), ('genoanime', 'genoanime', 'GenoAnime'), ('itsaturday', 'itsaturday', 'Itsaturday'), ('justdubs', 'justdubs', 'JustDubs'),