]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/wrzuta.py
1 # -*- coding: utf-8 -*-
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
13 class WrzutaIE(InfoExtractor
):
16 _VALID_URL
= r
'https?://(?P<uploader>[0-9a-zA-Z]+)\.wrzuta\.pl/(?P<typ>film|audio)/(?P<id>[0-9a-zA-Z]+)'
19 'url': 'http://laboratoriumdextera.wrzuta.pl/film/aq4hIZWrkBu/nike_football_the_last_game',
20 'md5': '9e67e05bed7c03b82488d87233a9efe7',
24 'title': 'Nike Football: The Last Game',
26 'uploader_id': 'laboratoriumdextera',
27 'description': 'md5:7fb5ef3c21c5893375fda51d9b15d9cd',
30 'url': 'http://w729.wrzuta.pl/audio/9oXJqdcndqv/david_guetta_amp_showtek_ft._vassy_-_bad',
31 'md5': '1e546a18e1c22ac6e9adce17b8961ff5',
35 'title': 'David Guetta & Showtek ft. Vassy - Bad',
37 'uploader_id': 'w729',
38 'description': 'md5:4628f01c666bbaaecefa83476cfa794a',
42 def _real_extract(self
, url
):
43 mobj
= re
.match(self
._VALID
_URL
, url
)
44 video_id
= mobj
.group('id')
45 typ
= mobj
.group('typ')
46 uploader
= mobj
.group('uploader')
48 webpage
= self
._download
_webpage
(url
, video_id
)
50 quality
= qualities(['SD', 'MQ', 'HQ', 'HD'])
52 audio_table
= {'flv': 'mp3', 'webm': 'ogg'}
54 embedpage
= self
._download
_json
('http://www.wrzuta.pl/npp/embed/%s/%s' % (uploader
, video_id
), video_id
)
57 for media
in embedpage
['url']:
59 ext
= audio_table
[media
['type'].split('@')[0]]
61 ext
= media
['type'].split('@')[0]
64 'format_id': '%s_%s' % (ext
, media
['quality'].lower()),
67 'quality': quality(media
['quality']),
70 self
._sort
_formats
(formats
)
74 'title': self
._og
_search
_title
(webpage
),
75 'thumbnail': self
._og
_search
_thumbnail
(webpage
),
77 'duration': int_or_none(embedpage
['duration']),
78 'uploader_id': uploader
,
79 'description': self
._og
_search
_description
(webpage
),
80 'age_limit': embedpage
.get('minimalAge', 0),