aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/videomega.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2014-09-18 00:18:27 +0200
committerPhilipp Hagemeister <phihag@phihag.de>2014-09-18 00:19:08 +0200
commit0e59b9fffb12255a16577dca7710b7738feca75c (patch)
treef4fd7b9dd3b6a814c3ccafae03912a7fc6de88e1 /youtube_dl/extractor/videomega.py
parent67abbe95273f59f4a04486172e6d422a10b6afb3 (diff)
[videomega] Simplify (#3786)
* Use raw strings (r'foo') for regular expressions (enables highlighting and avoids some errors). * title is always true-ish
Diffstat (limited to 'youtube_dl/extractor/videomega.py')
-rw-r--r--youtube_dl/extractor/videomega.py14
1 files changed, 6 insertions, 8 deletions
diff --git a/youtube_dl/extractor/videomega.py b/youtube_dl/extractor/videomega.py
index 1b6b65839..29c4e0101 100644
--- a/youtube_dl/extractor/videomega.py
+++ b/youtube_dl/extractor/videomega.py
@@ -34,22 +34,20 @@ class VideoMegaIE(InfoExtractor):
webpage = self._download_webpage(url, video_id)
escaped_data = self._search_regex(
- 'unescape\("([^"]+)"\)', webpage, 'escaped data')
+ r'unescape\("([^"]+)"\)', webpage, 'escaped data')
playlist = compat_urllib_parse.unquote(escaped_data)
thumbnail = self._search_regex(
r'image:\s*"([^"]+)"', playlist, 'thumbnail', fatal=False)
url = self._search_regex(r'file:\s*"([^"]+)"', playlist, 'URL')
- title = self._html_search_regex(
- r'<title>(.*?)</title>', webpage, 'title')
- if title:
- title = remove_start(title, 'VideoMega.tv - ')
+ title = remove_start(self._html_search_regex(
+ r'<title>(.*?)</title>', webpage, 'title'), 'VideoMega.tv - ')
- formats = []
- formats.append({
+ formats = [{
'format_id': 'sd',
'url': url,
- })
+ }]
+ self._sort_formats(formats)
return {
'id': video_id,