]>
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://jolka85.wrzuta.pl/audio/063jOPX5ue2/liber_natalia_szroeder_-_teraz_ty',
31 'md5': 'bc78077859bea7bcfe4295d7d7fc9025',
35 'title': 'Liber & Natalia Szroeder - Teraz Ty',
37 'uploader_id': 'jolka85',
38 'description': 'md5:2d2b6340f9188c8c4cd891580e481096',
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', '???': 'mp3'}
54 embedpage
= self
._download
_json
('http://www.wrzuta.pl/npp/embed/%s/%s' % (uploader
, video_id
), video_id
)
57 for media
in embedpage
['url']:
58 fmt
= media
['type'].split('@')[0]
60 ext
= audio_table
.get(fmt
, fmt
)
65 'format_id': '%s_%s' % (ext
, media
['quality'].lower()),
68 'quality': quality(media
['quality']),
71 self
._sort
_formats
(formats
)
75 'title': self
._og
_search
_title
(webpage
),
76 'thumbnail': self
._og
_search
_thumbnail
(webpage
),
78 'duration': int_or_none(embedpage
['duration']),
79 'uploader_id': uploader
,
80 'description': self
._og
_search
_description
(webpage
),
81 'age_limit': embedpage
.get('minimalAge', 0),