]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/laola1tv.py
263f687736c3f7fe3e980d79a10971a6dc4df5b2
1 from __future__
import unicode_literals
6 from .common
import InfoExtractor
9 class Laola1TvIE(InfoExtractor
):
10 _VALID_URL
= r
'https?://(?:www\.)?laola1\.tv/(?P<lang>[a-z]+)-(?P<portal>[a-z]+)/.*?/(?P<id>[0-9]+)\.html'
12 'url': 'http://www.laola1.tv/de-de/live/bwf-bitburger-open-grand-prix-gold-court-1/250019.html',
16 'title': 'Bitburger Open Grand Prix Gold - Court 1',
17 'categories': ['Badminton'],
18 'uploader': 'BWF - Badminton World Federation',
22 'skip_download': True,
26 _BROKEN
= True # Not really - extractor works fine, but f4m downloader does not support live streams yet.
28 def _real_extract(self
, url
):
29 mobj
= re
.match(self
._VALID
_URL
, url
)
30 video_id
= mobj
.group('id')
31 lang
= mobj
.group('lang')
32 portal
= mobj
.group('portal')
34 webpage
= self
._download
_webpage
(url
, video_id
)
35 iframe_url
= self
._search
_regex
(
36 r
'<iframe[^>]*?class="main_tv_player"[^>]*?src="([^"]+)"',
37 webpage
, 'iframe URL')
39 iframe
= self
._download
_webpage
(
40 iframe_url
, video_id
, note
='Downloading iframe')
41 flashvars_m
= re
.findall(
42 r
'flashvars\.([_a-zA-Z0-9]+)\s*=\s*"([^"]*)";', iframe
)
43 flashvars
= dict((m
[0], m
[1]) for m
in flashvars_m
)
45 xml_url
= ('http://www.laola1.tv/server/hd_video.php?' +
46 'play=%s&partner=1&portal=%s&v5ident=&lang=%s' % (
47 video_id
, portal
, lang
))
48 hd_doc
= self
._download
_xml
(xml_url
, video_id
)
50 title
= hd_doc
.find('.//video/title').text
51 flash_url
= hd_doc
.find('.//video/url').text
52 categories
= hd_doc
.find('.//video/meta_sports').text
.split(',')
53 uploader
= hd_doc
.find('.//video/meta_organistation').text
55 ident
= random
.randint(10000000, 99999999)
56 token_url
= '%s&ident=%s&klub=0&unikey=0×tamp=%s&auth=%s' % (
57 flash_url
, ident
, flashvars
['timestamp'], flashvars
['auth'])
59 token_doc
= self
._download
_xml
(
60 token_url
, video_id
, note
='Downloading token')
61 token_attrib
= token_doc
.find('.//token').attrib
62 if token_attrib
.get('auth') == 'blocked':
63 raise ExtractorError('Token error: ' % token_attrib
.get('comment'))
65 video_url
= '%s?hdnea=%s&hdcore=3.2.0' % (
66 token_attrib
['url'], token_attrib
['auth'])
74 'categories': categories
,