Skip to content

Commit

Permalink
more consistent vidstream (#485)
Browse files Browse the repository at this point in the history
  • Loading branch information
Blatzar authored Aug 22, 2020
1 parent 41a75c6 commit 6a6bf49
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions anime_downloader/extractors/vidstream.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
# <input type="hidden" id="id" value="MTEyMzg1">
# <input type="hidden" id="title" value="Yakusoku+no+Neverland">
# <input type="hidden" id="typesub" value="SUB">
# 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)))
"""
Expand All @@ -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:
Expand Down

0 comments on commit 6a6bf49

Please sign in to comment.