1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-24 12:15:40 +01:00

hls: sometimes they have the key as a filename without url

This commit is contained in:
Johan Andersson 2017-10-22 20:58:58 +02:00
parent 892b738bcb
commit 2c2446b30b

View File

@ -88,7 +88,11 @@ class HLS(VideoRetriever):
sys.exit(2) sys.exit(2)
match = re.search(r'URI="(https?://.*?)"', keydata) match = re.search(r'URI="(https?://.*?)"', keydata)
key = self.http.request("get", match.group(1)).content if not match:
match = re.search(r'URI="([^"]+)"', keydata)
keyurl = _get_full_url(match.group(1), self.url)
key = self.http.request("get", keyurl, cookies=cookies).content
rand = os.urandom(16) rand = os.urandom(16)
decryptor = AES.new(key, AES.MODE_CBC, rand) decryptor = AES.new(key, AES.MODE_CBC, rand)