]>
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 _extract_video_info(self
, partner_id
, video_id
):
46 data
= self
._download
_xml
(
47 'http://frontend.xstream.dk/%s/feed/video/?platform=web&id=%s'
48 % (partner_id
, video_id
),
52 'atom': 'http://www.w3.org/2005/Atom',
53 'xt': 'http://xstream.dk/',
54 'media': 'http://search.yahoo.com/mrss/',
57 entry
= data
.find(xpath_with_ns('./atom:entry', NS_MAP
))
60 entry
, xpath_with_ns('./atom:title', NS_MAP
), 'title')
61 description
= xpath_text(
62 entry
, xpath_with_ns('./atom:summary', NS_MAP
), 'description')
63 timestamp
= parse_iso8601(xpath_text(
64 entry
, xpath_with_ns('./atom:published', NS_MAP
), 'upload date'))
67 media_group
= entry
.find(xpath_with_ns('./media:group', NS_MAP
))
68 for media_content
in media_group
.findall(xpath_with_ns('./media:content', NS_MAP
)):
69 media_url
= media_content
.get('url')
72 tbr
= int_or_none(media_content
.get('bitrate'))
73 mobj
= re
.search(r
'^(?P<url>rtmp://[^/]+/(?P<app>[^/]+))/(?P<playpath>.+)$', media_url
)
76 'url': mobj
.group('url'),
77 'play_path': 'mp4:%s' % mobj
.group('playpath'),
78 'app': mobj
.group('app'),
81 'format_id': 'rtmp-%d' % tbr
,
88 self
._sort
_formats
(formats
)
90 link
= find_xpath_attr(
91 entry
, xpath_with_ns('./atom:link', NS_MAP
), 'rel', 'original')
94 'url': link
.get('href'),
95 'format_id': link
.get('rel'),
100 'url': splash
.get('url'),
101 'width': int_or_none(splash
.get('width')),
102 'height': int_or_none(splash
.get('height')),
103 } for splash
in media_group
.findall(xpath_with_ns('./xt:splash', NS_MAP
))]
108 'description': description
,
109 'timestamp': timestamp
,
111 'thumbnails': thumbnails
,
114 def _real_extract(self
, url
):
115 mobj
= re
.match(self
._VALID
_URL
, url
)
116 partner_id
= mobj
.group('partner_id')
117 video_id
= mobj
.group('id')
119 return self
._extract
_video
_info
(partner_id
, video_id
)