]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/trilulilu.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
7 from ..utils
import ExtractorError
10 class TriluliluIE(InfoExtractor
):
11 _VALID_URL
= r
'https?://(?:www\.)?trilulilu\.ro/(?:video-[^/]+/)?(?P<id>[^/#\?]+)'
13 'url': 'http://www.trilulilu.ro/video-animatie/big-buck-bunny-1',
14 'md5': 'c1450a00da251e2769b74b9005601cac',
16 'id': 'ae2899e124140b',
18 'title': 'Big Buck Bunny',
19 'description': ':) pentru copilul din noi',
23 def _real_extract(self
, url
):
24 display_id
= self
._match
_id
(url
)
25 webpage
= self
._download
_webpage
(url
, display_id
)
27 if re
.search(r
'Fişierul nu este disponibil pentru vizionare în ţara dumneavoastră', webpage
):
29 'This video is not available in your country.', expected
=True)
30 elif re
.search('Fişierul poate fi accesat doar de către prietenii lui', webpage
):
31 raise ExtractorError('This video is private.', expected
=True)
33 flashvars_str
= self
._search
_regex
(
34 r
'block_flash_vars\s*=\s*(\{[^\}]+\})', webpage
, 'flashvars', fatal
=False, default
=None)
37 flashvars
= self
._parse
_json
(flashvars_str
, display_id
)
40 'This page does not contain videos', expected
=True)
42 if flashvars
['isMP3'] == 'true':
44 'Audio downloads are currently not supported', expected
=True)
46 video_id
= flashvars
['hash']
47 title
= self
._og
_search
_title
(webpage
)
48 thumbnail
= self
._og
_search
_thumbnail
(webpage
)
49 description
= self
._og
_search
_description
(webpage
, default
=None)
51 format_url
= ('http://fs%(server)s.trilulilu.ro/%(hash)s/'
52 'video-formats2' % flashvars
)
53 format_doc
= self
._download
_xml
(
55 note
='Downloading formats',
56 errnote
='Error while downloading formats')
58 video_url_template
= (
59 'http://fs%(server)s.trilulilu.ro/stream.php?type=video'
60 '&source=site&hash=%(hash)s&username=%(userid)s&'
61 'key=ministhebest&format=%%s&sig=&exp=' %
65 'format_id': fnode
.text
.partition('-')[2],
66 'url': video_url_template
% fnode
.text
,
67 'ext': fnode
.text
.partition('-')[0]
70 for fnode
in format_doc
.findall('./formats/format')
75 'display_id': display_id
,
78 'description': description
,
79 'thumbnail': thumbnail
,