aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/extractor/roxwel.py
diff options
context:
space:
mode:
authorIsmael Mejia <iemejia@gmail.com>2013-08-22 23:29:36 +0200
committerIsmael Mejia <iemejia@gmail.com>2013-08-22 23:29:36 +0200
commit18b4e04f1c663e0ea695f6501b860f85af9d7ca1 (patch)
treed60ebbf51b8c50f808c6c251fc6c02547052a9dc /youtube_dl/extractor/roxwel.py
parentd80a064eff4fe2416f9db36b07f1e2ca641f1334 (diff)
parent1865ed31b955795f9859df5c1c400d172ae9a28a (diff)
Merge branch 'master' into subtitles_rework
Diffstat (limited to 'youtube_dl/extractor/roxwel.py')
-rw-r--r--youtube_dl/extractor/roxwel.py49
1 files changed, 49 insertions, 0 deletions
diff --git a/youtube_dl/extractor/roxwel.py b/youtube_dl/extractor/roxwel.py
new file mode 100644
index 000000000..d339e6cb5
--- /dev/null
+++ b/youtube_dl/extractor/roxwel.py
@@ -0,0 +1,49 @@
+import re
+import json
+
+from .common import InfoExtractor
+from ..utils import unified_strdate, determine_ext
+
+
+class RoxwelIE(InfoExtractor):
+ _VALID_URL = r'https?://www\.roxwel\.com/player/(?P<filename>.+?)(\.|\?|$)'
+
+ _TEST = {
+ u'url': u'http://www.roxwel.com/player/passionpittakeawalklive.html',
+ u'file': u'passionpittakeawalklive.flv',
+ u'md5': u'd9dea8360a1e7d485d2206db7fe13035',
+ u'info_dict': {
+ u'title': u'Take A Walk (live)',
+ u'uploader': u'Passion Pit',
+ u'description': u'Passion Pit performs "Take A Walk\" live at The Backyard in Austin, Texas. ',
+ },
+ u'skip': u'Requires rtmpdump',
+ }
+
+ def _real_extract(self, url):
+ mobj = re.match(self._VALID_URL, url)
+ filename = mobj.group('filename')
+ info_url = 'http://www.roxwel.com/api/videos/%s' % filename
+ info_page = self._download_webpage(info_url, filename,
+ u'Downloading video info')
+
+ self.report_extraction(filename)
+ info = json.loads(info_page)
+ rtmp_rates = sorted([int(r.replace('flv_', '')) for r in info['media_rates'] if r.startswith('flv_')])
+ best_rate = rtmp_rates[-1]
+ url_page_url = 'http://roxwel.com/pl_one_time.php?filename=%s&quality=%s' % (filename, best_rate)
+ rtmp_url = self._download_webpage(url_page_url, filename, u'Downloading video url')
+ ext = determine_ext(rtmp_url)
+ if ext == 'f4v':
+ rtmp_url = rtmp_url.replace(filename, 'mp4:%s' % filename)
+
+ return {'id': filename,
+ 'title': info['title'],
+ 'url': rtmp_url,
+ 'ext': 'flv',
+ 'description': info['description'],
+ 'thumbnail': info.get('player_image_url') or info.get('image_url_large'),
+ 'uploader': info['artist'],
+ 'uploader_id': info['artistname'],
+ 'upload_date': unified_strdate(info['dbdate']),
+ }