diff options
author | Yen Chi Hsuan <yan12125@gmail.com> | 2016-02-26 15:13:35 +0800 |
---|---|---|
committer | Yen Chi Hsuan <yan12125@gmail.com> | 2016-02-26 15:14:13 +0800 |
commit | efbd6fb8bb86c07e6f924a7ec2c4bd486face3a4 (patch) | |
tree | b7ba85f7f9f5d5ff4016ccb5851fbff290041eb0 | |
parent | 680079be39563a2ff810602413db5245d6cbf148 (diff) |
[vidzi] Use decode_packed_codes
Javascript codes found on Vidzi are slightly different from those found
in VideoMega and iQiyi. Nevertheless, the difference has no effects on
the final result.
-rw-r--r-- | youtube_dl/extractor/vidzi.py | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/youtube_dl/extractor/vidzi.py b/youtube_dl/extractor/vidzi.py index d671e27de..3c78fb3d5 100644 --- a/youtube_dl/extractor/vidzi.py +++ b/youtube_dl/extractor/vidzi.py @@ -1,11 +1,9 @@ # coding: utf-8 from __future__ import unicode_literals -import re - from .jwplatform import JWPlatformBaseIE from ..utils import ( - base_n, + decode_packed_codes, js_to_json, ) @@ -33,18 +31,7 @@ class VidziIE(JWPlatformBaseIE): title = self._html_search_regex( r'(?s)<h2 class="video-title">(.*?)</h2>', webpage, 'title') - mobj = re.search(r"}\('(.+)',36,(\d+),'([^']+)'\.split\('\|'\)", webpage) - code, count, symbols = mobj.groups() - - count = int(count) - symbols = symbols.split('|') - - while count: - count -= 1 - if symbols[count]: - code = re.sub(r'\b%s\b' % base_n(count, 36), symbols[count], code) - - code = code.replace('\\\'', '\'') + code = decode_packed_codes(webpage).replace('\\\'', '\'') jwplayer_data = self._parse_json( self._search_regex(r'setup\(([^)]+)\)', code, 'jwplayer data'), video_id, transform_source=js_to_json) |