]>
Commit | Line | Data |
---|---|---|
986f5673 JMF |
1 | from __future__ import unicode_literals |
2 | ||
58261235 JMF |
3 | |
4 | from .common import InfoExtractor | |
5 | from ..utils import unified_strdate, determine_ext | |
6 | ||
7 | ||
8 | class RoxwelIE(InfoExtractor): | |
92519402 | 9 | _VALID_URL = r'https?://(?:www\.)?roxwel\.com/player/(?P<filename>.+?)(\.|\?|$)' |
58261235 JMF |
10 | |
11 | _TEST = { | |
986f5673 JMF |
12 | 'url': 'http://www.roxwel.com/player/passionpittakeawalklive.html', |
13 | 'info_dict': { | |
14 | 'id': 'passionpittakeawalklive', | |
15 | 'ext': 'flv', | |
16 | 'title': 'Take A Walk (live)', | |
17 | 'uploader': 'Passion Pit', | |
18 | 'uploader_id': 'passionpit', | |
19 | 'upload_date': '20120928', | |
20 | 'description': 'Passion Pit performs "Take A Walk\" live at The Backyard in Austin, Texas. ', | |
58261235 | 21 | }, |
986f5673 JMF |
22 | 'params': { |
23 | # rtmp download | |
24 | 'skip_download': True, | |
25 | } | |
58261235 JMF |
26 | } |
27 | ||
28 | def _real_extract(self, url): | |
5ad28e7f | 29 | mobj = self._match_valid_url(url) |
58261235 JMF |
30 | filename = mobj.group('filename') |
31 | info_url = 'http://www.roxwel.com/api/videos/%s' % filename | |
986f5673 | 32 | info = self._download_json(info_url, filename) |
58261235 | 33 | |
58261235 JMF |
34 | rtmp_rates = sorted([int(r.replace('flv_', '')) for r in info['media_rates'] if r.startswith('flv_')]) |
35 | best_rate = rtmp_rates[-1] | |
36 | url_page_url = 'http://roxwel.com/pl_one_time.php?filename=%s&quality=%s' % (filename, best_rate) | |
986f5673 | 37 | rtmp_url = self._download_webpage(url_page_url, filename, 'Downloading video url') |
58261235 JMF |
38 | ext = determine_ext(rtmp_url) |
39 | if ext == 'f4v': | |
40 | rtmp_url = rtmp_url.replace(filename, 'mp4:%s' % filename) | |
41 | ||
986f5673 JMF |
42 | return { |
43 | 'id': filename, | |
44 | 'title': info['title'], | |
45 | 'url': rtmp_url, | |
46 | 'ext': 'flv', | |
47 | 'description': info['description'], | |
48 | 'thumbnail': info.get('player_image_url') or info.get('image_url_large'), | |
49 | 'uploader': info['artist'], | |
50 | 'uploader_id': info['artistname'], | |
51 | 'upload_date': unified_strdate(info['dbdate']), | |
52 | } |