Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[tubitv] Fix extraction #8741

Closed
remitamine opened this issue Mar 3, 2016 · 0 comments
Closed

[tubitv] Fix extraction #8741

remitamine opened this issue Mar 3, 2016 · 0 comments

Comments

@remitamine
Copy link
Collaborator

@remitamine remitamine commented Mar 3, 2016

tubitv now uses Stanford Javascript Crypto Library to decrypt the apu.
this is the part to extract the decryption information.

diff --git a/youtube_dl/extractor/tubitv.py b/youtube_dl/extractor/tubitv.py
index 6d78b5d..033c5ec 100644
--- a/youtube_dl/extractor/tubitv.py
+++ b/youtube_dl/extractor/tubitv.py
@@ -2,6 +2,7 @@
 from __future__ import unicode_literals

 import codecs
+import base64
 import re

 from .common import InfoExtractor
@@ -67,6 +68,13 @@ class TubiTvIE(InfoExtractor):
             'video:duration', webpage, 'duration'))

         apu = self._search_regex(r"apu='([^']+)'", webpage, 'apu')
+        def _xor(a, b):
+            c = ''
+            for d in range(len(b)):
+                c += chr(ord(b[d]) ^ ord(a[d % len(a)]))
+            return c
+        _l = apu.split('&')
+        sjcl = self._parse_json(_xor(_l[0], base64.b64decode(_l[1]).decode()), video_id)
         m3u8_url = codecs.decode(apu, 'rot_13')[::-1]
         formats = self._extract_m3u8_formats(m3u8_url, video_id, ext='mp4')

the decryption information(sjcl) looks like:

{"iv":"b4pG0hbUv1AqXWmRc3Wt0Q==","v":1,"iter":1000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"jQebi0J5Gz4=","ct":"aQ46lVNvulftOWEppEMXW20U8OZUaIJgXMSDwcC3XgyOSFUoRZ72YPXI0EZs5VoD+zRBVJQ3VnoYIEjsDJ+soHpc3JqZjYSawp8Ndynr62d/do2ec/p0DO1VTZPNRNm035iGWiSlpc3qDWSB"}

as i know youtube-dl doesn't support CCM mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.