diff options
author | Sergey M․ <dstftw@gmail.com> | 2015-12-19 19:08:47 +0600 |
---|---|---|
committer | Sergey M․ <dstftw@gmail.com> | 2015-12-19 19:16:49 +0600 |
commit | ffaf6e66e3830d0e4750aec2cfdaff1a6bd9c2ad (patch) | |
tree | c4287add32f399992a0f57a73b7de7d616f27bdf /youtube_dl | |
parent | 74c730174fa872ae37b4709a3a452391ee6273fb (diff) | |
download | youtube-dl-ffaf6e66e3830d0e4750aec2cfdaff1a6bd9c2ad.tar.xz |
[toggle] Improve
Diffstat (limited to 'youtube_dl')
-rw-r--r-- | youtube_dl/extractor/togglesg.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/youtube_dl/extractor/togglesg.py b/youtube_dl/extractor/togglesg.py index d3903b58d..244c79e8d 100644 --- a/youtube_dl/extractor/togglesg.py +++ b/youtube_dl/extractor/togglesg.py @@ -84,12 +84,15 @@ class ToggleSgIE(InfoExtractor): def _real_extract(self, url): video_id = self._match_id(url) - webpage = self._download_webpage(url, video_id, note='Downloading video page') + webpage = self._download_webpage( + url, video_id, note='Downloading video page') api_user = self._search_regex( - r'apiUser:\s*"([^"]+)"', webpage, 'apiUser', default=self._API_USER) + r'apiUser\s*:\s*(["\'])(?P<user>.+?)\1', webpage, 'apiUser', + default=self._API_USER, group='user') api_pass = self._search_regex( - r'apiPass:\s*"([^"]+)"', webpage, 'apiPass', default=self._API_PASS) + r'apiPass\s*:\s*(["\'])(?P<pass>.+?)\1', webpage, 'apiPass', + default=self._API_PASS, group='pass') params = { 'initObj': { @@ -131,11 +134,10 @@ class ToggleSgIE(InfoExtractor): video_file['URL'], video_id, ext='mp4', m3u8_id=vid_format, note='Downloading %s m3u8 information' % vid_format, errnote='Failed to download %s m3u8 information' % vid_format, - fatal=False - ) + fatal=False) if m3u8_formats: formats.extend(m3u8_formats) - if ext in ['mp4', 'wvm']: + elif ext in ('mp4', 'wvm'): # wvm are drm-protected files formats.append({ 'ext': ext, |