more consistent vidstream (#485)

master
Blatzar 2020-08-22 18:43:04 +02:00 committed by GitHub
parent 41a75c61a5
commit 6a6bf49ede
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 8 deletions

View File

@ -55,13 +55,21 @@ class VidStream(BaseExtractor):
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)))
"""
@ -80,7 +88,7 @@ class VidStream(BaseExtractor):
"""
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: