3 from .common
import InfoExtractor
13 class XstreamIE(InfoExtractor
):
17 https?://frontend\.xstream\.(?:dk|net)/
22 /feed/video/\?.*?\bid=
27 'url': 'http://frontend.xstream.dk/btno/feed/video/?platform=web&id=86588',
28 'md5': 'd7d17e3337dc80de6d3a540aefbe441b',
32 'title': 'Otto Wollertsen',
33 'description': 'Vestlendingen Otto Fredrik Wollertsen',
34 'timestamp': 1430473209,
35 'upload_date': '20150501',
38 'url': 'http://frontend.xstream.dk/ap/feed/video/?platform=web&id=21039',
39 'only_matching': True,
42 def _extract_video_info(self
, partner_id
, video_id
):
43 data
= self
._download
_xml
(
44 f
'http://frontend.xstream.dk/{partner_id}/feed/video/?platform=web&id={video_id}',
48 'atom': 'http://www.w3.org/2005/Atom',
49 'xt': 'http://xstream.dk/',
50 'media': 'http://search.yahoo.com/mrss/',
53 entry
= data
.find(xpath_with_ns('./atom:entry', NS_MAP
))
56 entry
, xpath_with_ns('./atom:title', NS_MAP
), 'title')
57 description
= xpath_text(
58 entry
, xpath_with_ns('./atom:summary', NS_MAP
), 'description')
59 timestamp
= parse_iso8601(xpath_text(
60 entry
, xpath_with_ns('./atom:published', NS_MAP
), 'upload date'))
63 media_group
= entry
.find(xpath_with_ns('./media:group', NS_MAP
))
64 for media_content
in media_group
.findall(xpath_with_ns('./media:content', NS_MAP
)):
65 media_url
= media_content
.get('url')
68 tbr
= int_or_none(media_content
.get('bitrate'))
69 mobj
= re
.search(r
'^(?P<url>rtmp://[^/]+/(?P<app>[^/]+))/(?P<playpath>.+)$', media_url
)
72 'url': mobj
.group('url'),
73 'play_path': 'mp4:{}'.format(mobj
.group('playpath')),
74 'app': mobj
.group('app'),
77 'format_id': 'rtmp-%d' % tbr
,
85 link
= find_xpath_attr(
86 entry
, xpath_with_ns('./atom:link', NS_MAP
), 'rel', 'original')
89 'url': link
.get('href'),
90 'format_id': link
.get('rel'),
95 'url': splash
.get('url'),
96 'width': int_or_none(splash
.get('width')),
97 'height': int_or_none(splash
.get('height')),
98 } for splash
in media_group
.findall(xpath_with_ns('./xt:splash', NS_MAP
))]
103 'description': description
,
104 'timestamp': timestamp
,
106 'thumbnails': thumbnails
,
109 def _real_extract(self
, url
):
110 mobj
= self
._match
_valid
_url
(url
)
111 partner_id
= mobj
.group('partner_id')
112 video_id
= mobj
.group('id')
114 return self
._extract
_video
_info
(partner_id
, video_id
)