Skip to content

Commit

Permalink
Fix mystream.to (jsergio123#298)
Browse files Browse the repository at this point in the history
  • Loading branch information
Gujal00 committed Mar 19, 2020
1 parent 4a4170a commit 24105a3
Showing 1 changed file with 4 additions and 47 deletions.
51 changes: 4 additions & 47 deletions lib/resolveurl/plugins/mystream.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

class MystreamResolver(ResolveUrl):
name = "mystream"
domains = ['mystream.la', 'mystream.to']
domains = ['mystream.la', 'mystream.to', 'mstream.xyz', 'mstream.cloud']
pattern = r'(?://|\.)(my?stream\.(?:la|to|cloud|xyz))/(?:external|watch/)?([0-9a-zA-Z_]+)'

def __init__(self):
Expand All @@ -40,55 +40,12 @@ def get_media_url(self, host, media_id):
if "unable to find the video" in html:
raise ResolverError('The requested video was not found or may have been removed.')

match = re.search(r'type="file".+?script>\s*([^<]+)', html, re.DOTALL)
match = re.search(r'og:image".+?"(.+)/', html)
if match:
aa_text = aadecode.decode(match.group(1).encode('utf8'))
match = re.search(r"atob\('([^']+)", aa_text)
if match:
etext = match.group(1).decode("base64")
secret = self.vv_secret(html)
stream_url = self.vv_decrypt(secret, etext)
return stream_url + helpers.append_headers(headers)
stream_url = '{0}.mp4'.format(match.group(1))
return stream_url + helpers.append_headers(headers)

raise ResolverError('Video Link Not Found')

def get_url(self, host, media_id):
return self._default_get_url(host, media_id, 'https://embed.mystream.to/{media_id}')

def vv_secret(self, page):
jjtext = re.search("<script>([^<]+)", page)
jjdecoded = jjdecode.JJDecoder(jjtext.group(1)).decode()
parts = re.search(r"atob\('([^']+)", jjdecoded).group(1).decode("base64").split("|")
hash_val = parts[1]
var_sec = re.findall(r"<script>var[^=]+=\s*(.+?){if", page)[0]
words = re.findall(r"'(?!get|set|]|\))([^']{10,})'", var_sec)
words.sort(key=len)
n, l, h = words
domtable = {}
for j in range(len(l)):
for k in range(len(n)):
domtable[l[j] + n[k]] = h[j + k]
key = ""
for i in range(0, len(hash_val), 2):
key = key + domtable[hash_val[i] + hash_val[i + 1]]
return key

def vv_decrypt(self, key, enc_text):
a = range(256)
j = 0
y = ''
for i in range(256):
j = (j + a[i] + ord(key[i % len(key)])) % 256
s = a[i]
a[i] = a[j]
a[j] = s
i = 0
j = 0
for k in range(len(enc_text)):
i = (i + 1) % 256
j = (j + a[i]) % 256
s = a[i]
a[i] = a[j]
a[j] = s
y += chr(ord(enc_text[k]) ^ a[(a[i] + a[j]) % 256])
return y

0 comments on commit 24105a3

Please sign in to comment.