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