]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/cinchcast.py
debian/changelog: Highlight the fix of youtube videos.
[youtubedl] / youtube_dl / extractor / cinchcast.py
1 # coding: utf-8
2 from __future__ import unicode_literals
3
4 from .common import InfoExtractor
5 from ..utils import (
6 unified_strdate,
7 xpath_text,
8 )
9
10
11 class CinchcastIE(InfoExtractor):
12 _VALID_URL = r'https?://player\.cinchcast\.com/.*?assetId=(?P<id>[0-9]+)'
13 _TEST = {
14 # Actual test is run in generic, look for undergroundwellness
15 'url': 'http://player.cinchcast.com/?platformId=1&#038;assetType=single&#038;assetId=7141703',
16 'only_matching': True,
17 }
18
19 def _real_extract(self, url):
20 video_id = self._match_id(url)
21 doc = self._download_xml(
22 'http://www.blogtalkradio.com/playerasset/mrss?assetType=single&assetId=%s' % video_id,
23 video_id)
24
25 item = doc.find('.//item')
26 title = xpath_text(item, './title', fatal=True)
27 date_str = xpath_text(
28 item, './{http://developer.longtailvideo.com/trac/}date')
29 upload_date = unified_strdate(date_str, day_first=False)
30 # duration is present but wrong
31 formats = []
32 formats.append({
33 'format_id': 'main',
34 'url': item.find(
35 './{http://search.yahoo.com/mrss/}content').attrib['url'],
36 })
37 backup_url = xpath_text(
38 item, './{http://developer.longtailvideo.com/trac/}backupContent')
39 if backup_url:
40 formats.append({
41 'preference': 2, # seems to be more reliable
42 'format_id': 'backup',
43 'url': backup_url,
44 })
45 self._sort_formats(formats)
46
47 return {
48 'id': video_id,
49 'title': title,
50 'upload_date': upload_date,
51 'formats': formats,
52 }