From 6a6bf49edeb64fc2cd63458a29ba84a956f53639 Mon Sep 17 00:00:00 2001 From: Blatzar <46196380+Blatzar@users.noreply.github.com> Date: Sat, 22 Aug 2020 18:43:04 +0200 Subject: [PATCH] more consistent vidstream (#485) --- anime_downloader/extractors/vidstream.py | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/anime_downloader/extractors/vidstream.py b/anime_downloader/extractors/vidstream.py index 1a958c85..c24f69ea 100644 --- a/anime_downloader/extractors/vidstream.py +++ b/anime_downloader/extractors/vidstream.py @@ -55,13 +55,21 @@ def _get_data(self): def _get_link(self,soup): - """ - Matches something like - f("MTE2MDIw&title=Yakusoku+no+Neverland"); - """ - sources_regex = r'>\s*?f\("(.*?)"\);' - sources_url = re.search(sources_regex,str(soup)).group(1) - sources_json = helpers.get(f'https://vidstreaming.io/ajax.php?id={sources_url}', referer=self.url).json() + + # Gets: + # + # + # + # Used to create a download url. + soup_id = soup.select('input#id')[0]['value'] + soup_title = soup.select('input#title')[0]['value'] + soup_typesub = soup.select('input#typesub')[0].get('value','SUB') + + sources_json = helpers.get(f'https://vidstreaming.io/ajax.php', params = { + 'id':soup_id, + 'typesub':soup_typesub, + 'title':soup_title, + }, referer=self.url).json() logger.debug('Sources json: {}'.format(str(sources_json))) """ @@ -80,7 +88,7 @@ def _get_link(self,soup): """ servers = Config._read_config()['siteconfig']['vidstream']['servers'] - print(sources_json["source"][0]["file"]) + for i in servers: if i in sources_keys: if sources_keys[i] in sources_json: