diff options
author | Naglis Jonaitis <njonaitis@gmail.com> | 2015-01-22 18:35:53 +0200 |
---|---|---|
committer | Naglis Jonaitis <njonaitis@gmail.com> | 2015-01-22 18:36:49 +0200 |
commit | bb6e38787dcc3593a4d9cb66bcf9f736570e944a (patch) | |
tree | 0da139bedea322ee84d1b9c8642ee98ea081e786 /youtube_dl/extractor/videomega.py | |
parent | 898c23c03f634d14fa414f0e0693d5c4033b2671 (diff) |
[videomega] Fix extraction (Closes #4763)
Diffstat (limited to 'youtube_dl/extractor/videomega.py')
-rw-r--r-- | youtube_dl/extractor/videomega.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/youtube_dl/extractor/videomega.py b/youtube_dl/extractor/videomega.py index 9fc64d172..fc6e05fe0 100644 --- a/youtube_dl/extractor/videomega.py +++ b/youtube_dl/extractor/videomega.py @@ -1,12 +1,15 @@ # coding: utf-8 from __future__ import unicode_literals +import re + from .common import InfoExtractor from ..compat import ( compat_urllib_parse, compat_urllib_request, ) from ..utils import ( + ExtractorError, remove_start, ) @@ -35,8 +38,11 @@ class VideoMegaIE(InfoExtractor): req.add_header('Referer', url) webpage = self._download_webpage(req, video_id) - escaped_data = self._search_regex( - r'unescape\("([^"]+)"\)', webpage, 'escaped data') + try: + escaped_data = re.findall(r'unescape\("([^"]+)"\)', webpage)[-1] + except IndexError: + raise ExtractorError('Unable to extract escaped data') + playlist = compat_urllib_parse.unquote(escaped_data) thumbnail = self._search_regex( |