diff options
author | Yen Chi Hsuan <yan12125@gmail.com> | 2015-07-02 16:47:55 +0800 |
---|---|---|
committer | Yen Chi Hsuan <yan12125@gmail.com> | 2015-07-02 16:47:55 +0800 |
commit | 8d06a62485ddd2cff396287f6b39614afd1e6033 (patch) | |
tree | a64910c42d4feeff768a3436c03115f442782b1f /youtube_dl/extractor/npo.py | |
parent | 93f942099351895c16ef558366f3eab241cd8793 (diff) |
[npo] Decrypting token (closes #6136)
Diffstat (limited to 'youtube_dl/extractor/npo.py')
-rw-r--r-- | youtube_dl/extractor/npo.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/youtube_dl/extractor/npo.py b/youtube_dl/extractor/npo.py index 5d8448571..41d7e3fcc 100644 --- a/youtube_dl/extractor/npo.py +++ b/youtube_dl/extractor/npo.py @@ -16,8 +16,23 @@ class NPOBaseIE(InfoExtractor): token_page = self._download_webpage( 'http://ida.omroep.nl/npoplayer/i.js', video_id, note='Downloading token') - return self._search_regex( + token = self._search_regex( r'npoplayer\.token = "(.+?)"', token_page, 'token') + token_l = list(token) + first = second = None + for i in range(5, len(token_l) - 4): + if token_l[i].isdigit(): + if first is None: + first = i + elif second is None: + second = i + if first is None or second is None: + first = 12 + second = 13 + + token_l[first], token_l[second] = token_l[second], token_l[first] + + return ''.join(token_l) class NPOIE(NPOBaseIE): @@ -92,7 +107,7 @@ class NPOIE(NPOBaseIE): def _get_info(self, video_id): metadata = self._download_json( - 'http://e.omroep.nl/metadata/aflevering/%s' % video_id, + 'http://e.omroep.nl/metadata/%s' % video_id, video_id, # We have to remove the javascript callback transform_source=strip_jsonp, |