]>
Commit | Line | Data |
---|---|---|
42bdd9d0 PH |
1 | from .common import InfoExtractor |
2 | from ..utils import ( | |
42bdd9d0 PH |
3 | unified_strdate, |
4 | xpath_text, | |
5 | ) | |
6 | ||
7 | ||
8 | class CinchcastIE(InfoExtractor): | |
c983cc3b S |
9 | _VALID_URL = r'https?://player\.cinchcast\.com/.*?(?:assetId|show_id)=(?P<id>[0-9]+)' |
10 | _TESTS = [{ | |
11 | 'url': 'http://player.cinchcast.com/?show_id=5258197&platformId=1&assetType=single', | |
12 | 'info_dict': { | |
13 | 'id': '5258197', | |
14 | 'ext': 'mp3', | |
15 | 'title': 'Train Your Brain to Up Your Game with Coach Mandy', | |
16 | 'upload_date': '20130816', | |
17 | }, | |
18 | }, { | |
42bdd9d0 PH |
19 | # Actual test is run in generic, look for undergroundwellness |
20 | 'url': 'http://player.cinchcast.com/?platformId=1&assetType=single&assetId=7141703', | |
21 | 'only_matching': True, | |
c983cc3b | 22 | }] |
42bdd9d0 PH |
23 | |
24 | def _real_extract(self, url): | |
25 | video_id = self._match_id(url) | |
26 | doc = self._download_xml( | |
27 | 'http://www.blogtalkradio.com/playerasset/mrss?assetType=single&assetId=%s' % video_id, | |
28 | video_id) | |
29 | ||
30 | item = doc.find('.//item') | |
31 | title = xpath_text(item, './title', fatal=True) | |
32 | date_str = xpath_text( | |
33 | item, './{http://developer.longtailvideo.com/trac/}date') | |
34 | upload_date = unified_strdate(date_str, day_first=False) | |
35 | # duration is present but wrong | |
a52c6335 PH |
36 | formats = [{ |
37 | 'format_id': 'main', | |
38 | 'url': item.find('./{http://search.yahoo.com/mrss/}content').attrib['url'], | |
39 | }] | |
42bdd9d0 PH |
40 | backup_url = xpath_text( |
41 | item, './{http://developer.longtailvideo.com/trac/}backupContent') | |
42 | if backup_url: | |
43 | formats.append({ | |
44 | 'preference': 2, # seems to be more reliable | |
45 | 'format_id': 'backup', | |
46 | 'url': backup_url, | |
47 | }) | |
48 | self._sort_formats(formats) | |
49 | ||
50 | return { | |
51 | 'id': video_id, | |
52 | 'title': title, | |
53 | 'upload_date': upload_date, | |
54 | 'formats': formats, | |
55 | } |