fix wstream

This commit is contained in:
mac12m99
2021-03-31 21:05:18 +02:00
parent 36ae7ea078
commit 20941d820b

View File

@@ -17,24 +17,25 @@ errorsStr = ['Sorry this file is not longer available', 'Sorry this video is una
def test_video_exists(page_url):
global headers
headers = [['User-Agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0']]
logger.debug("(page_url='%s')" % page_url)
disable_directIP = False
if 'swvideoid' in page_url: disable_directIP = True
resp = httptools.downloadpage(page_url, headers=headers, verify=False, disable_directIP=disable_directIP)
# if 'swvideoid' in page_url: disable_directIP = True
resp = httptools.downloadpage(page_url, verify=False, disable_directIP=disable_directIP, follow_redirects=False)
while resp.headers.get('location'):
page_url = resp.headers.get('location')
resp = httptools.downloadpage(page_url, verify=False, disable_directIP=disable_directIP, follow_redirects=False)
global data, real_url
data = resp.data
if '/streaming.php' in page_url in page_url:
code = httptools.downloadpage(page_url, headers=headers, follow_redirects=False, only_headers=True, verify=False).headers['location'].split('/')[-1].replace('.html', '')
code = httptools.downloadpage(page_url, follow_redirects=False, only_headers=True, verify=False).headers['location'].split('/')[-1].replace('.html', '')
# logger.debug('WCODE=' + code)
page_url = 'https://wstream.video/video.php?file_code=' + code
data = httptools.downloadpage(page_url, headers=headers, follow_redirects=True, verify=False).data
data = httptools.downloadpage(page_url, follow_redirects=True, verify=False).data
if 'nored.icu' in str(headers):
if 'nored.icu' in page_url:
var = scrapertools.find_single_match(data, r'var [a-zA-Z0-9]+ = \[([^\]]+).*?')
value = scrapertools.find_single_match(data, r'String\.fromCharCode\(parseInt\(value\) \D (\d+)')
if var and value:
@@ -42,8 +43,7 @@ def test_video_exists(page_url):
for v in var.split(','):
dec += chr(int(v) - int(value))
page_url = 'https://wstream.video/video.php?file_code=' + scrapertools.find_single_match(dec, "src='([^']+)").split('/')[-1].replace('.html','')
headers = [['User-Agent', 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:54.0) Gecko/20100101 Firefox/54.0'],['Host', 'wstream.video']]
new_data = httptools.downloadpage(page_url, headers=headers, follow_redirects=True, verify=False).data
new_data = httptools.downloadpage(page_url, follow_redirects=True, verify=False).data
logger.debug('NEW DATA: \n' + new_data)
if new_data:
data = new_data
@@ -66,7 +66,7 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
if page_url.startswith('/'):
page_url = 'https://wstream.video' + page_url
if page_url:
data = httptools.downloadpage(page_url, headers=headers, follow_redirects=True, post={'g-recaptcha-response': captcha}, verify=False).data
data = httptools.downloadpage(page_url, follow_redirects=True, post={'g-recaptcha-response': captcha}, verify=False).data
def getSources(data):
possibileSources = scrapertools.find_multiple_matches(data, r'sources:\s*(\[[^\]]+\])')
@@ -107,7 +107,7 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
post = {param[0]: param[1] for param in possibleParam if param[0]}
if captcha: post['g-recaptcha-response'] = captcha
if post:
data = httptools.downloadpage(real_url, headers=headers, post=post, follow_redirects=True, verify=False).data
data = httptools.downloadpage(real_url, post=post, follow_redirects=True, verify=False).data
elif captcha:
int_bckup_method()
elif captcha or not sitekey:
@@ -116,7 +116,7 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
platformtools.dialog_ok(config.get_localized_string(20000), config.get_localized_string(707434))
return []
headers.append(['Referer', real_url])
headers = [['Referer', real_url]]
_headers = urllib.urlencode(dict(headers))
post_data = scrapertools.find_single_match(data, r"<script type='text/javascript'>(eval.function.p,a,c,k,e,.*?)\s*</script>")