]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/xstream.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
16 class XstreamIE(InfoExtractor
):
20 https?://frontend\.xstream\.(?:dk|net)/
25 /feed/video/\?.*?\bid=
30 'url': 'http://frontend.xstream.dk/btno/feed/video/?platform=web&id=86588',
31 'md5': 'd7d17e3337dc80de6d3a540aefbe441b',
35 'title': 'Otto Wollertsen',
36 'description': 'Vestlendingen Otto Fredrik Wollertsen',
37 'timestamp': 1430473209,
38 'upload_date': '20150501',
41 'url': 'http://frontend.xstream.dk/ap/feed/video/?platform=web&id=21039',
42 'only_matching': True,
45 def _real_extract(self
, url
):
46 mobj
= re
.match(self
._VALID
_URL
, url
)
47 partner_id
= mobj
.group('partner_id')
48 video_id
= mobj
.group('id')
50 data
= self
._download
_xml
(
51 'http://frontend.xstream.dk/%s/feed/video/?platform=web&id=%s'
52 % (partner_id
, video_id
),
56 'atom': 'http://www.w3.org/2005/Atom',
57 'xt': 'http://xstream.dk/',
58 'media': 'http://search.yahoo.com/mrss/',
61 entry
= data
.find(xpath_with_ns('./atom:entry', NS_MAP
))
64 entry
, xpath_with_ns('./atom:title', NS_MAP
), 'title')
65 description
= xpath_text(
66 entry
, xpath_with_ns('./atom:summary', NS_MAP
), 'description')
67 timestamp
= parse_iso8601(xpath_text(
68 entry
, xpath_with_ns('./atom:published', NS_MAP
), 'upload date'))
71 media_group
= entry
.find(xpath_with_ns('./media:group', NS_MAP
))
72 for media_content
in media_group
.findall(xpath_with_ns('./media:content', NS_MAP
)):
73 media_url
= media_content
.get('url')
76 tbr
= int_or_none(media_content
.get('bitrate'))
77 mobj
= re
.search(r
'^(?P<url>rtmp://[^/]+/(?P<app>[^/]+))/(?P<playpath>.+)$', media_url
)
80 'url': mobj
.group('url'),
81 'play_path': 'mp4:%s' % mobj
.group('playpath'),
82 'app': mobj
.group('app'),
85 'format_id': 'rtmp-%d' % tbr
,
92 self
._sort
_formats
(formats
)
94 link
= find_xpath_attr(
95 entry
, xpath_with_ns('./atom:link', NS_MAP
), 'rel', 'original')
98 'url': link
.get('href'),
99 'format_id': link
.get('rel'),
103 'url': splash
.get('url'),
104 'width': int_or_none(splash
.get('width')),
105 'height': int_or_none(splash
.get('height')),
106 } for splash
in media_group
.findall(xpath_with_ns('./xt:splash', NS_MAP
))]
111 'description': description
,
112 'timestamp': timestamp
,
114 'thumbnails': thumbnails
,