]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/urort.py
[compat] Remove more functions
[yt-dlp.git] / yt_dlp / extractor / urort.py
CommitLineData
ac668111 1
2
3import urllib.parse
4
e2b06e76 5from .common import InfoExtractor
ac668111 6from ..utils import unified_strdate
e2b06e76
PH
7
8
9class UrortIE(InfoExtractor):
10 IE_DESC = 'NRK P3 Urørt'
11 _VALID_URL = r'https?://(?:www\.)?urort\.p3\.no/#!/Band/(?P<id>[^/]+)$'
12
13 _TEST = {
14 'url': 'https://urort.p3.no/#!/Band/Gerilja',
15 'md5': '5ed31a924be8a05e47812678a86e127b',
16 'info_dict': {
baa7081d 17 'id': '33124-24',
e2b06e76
PH
18 'ext': 'mp3',
19 'title': 'The Bomb',
ec85ded8 20 'thumbnail': r're:^https?://.+\.jpg',
e2b06e76
PH
21 'uploader': 'Gerilja',
22 'uploader_id': 'Gerilja',
0dae5083 23 'upload_date': '20100323',
e2b06e76
PH
24 },
25 'params': {
26 'matchtitle': '^The Bomb$', # To test, we want just one video
27 }
28 }
29
30 def _real_extract(self, url):
6a1b20de 31 playlist_id = self._match_id(url)
e2b06e76 32
ac668111 33 fstr = urllib.parse.quote("InternalBandUrl eq '%s'" % playlist_id)
baa7081d 34 json_url = 'http://urort.p3.no/breeze/urort/TrackDTOViews?$filter=%s&$orderby=Released%%20desc&$expand=Tags%%2CFiles' % fstr
e2b06e76 35 songs = self._download_json(json_url, playlist_id)
baa7081d
PH
36 entries = []
37 for s in songs:
38 formats = [{
39 'tbr': f.get('Quality'),
40 'ext': f['FileType'],
41 'format_id': '%s-%s' % (f['FileType'], f.get('Quality', '')),
42 'url': 'http://p3urort.blob.core.windows.net/tracks/%s' % f['FileRef'],
f983b875 43 'quality': 3 if f['FileType'] == 'mp3' else 2,
baa7081d
PH
44 } for f in s['Files']]
45 self._sort_formats(formats)
46 e = {
47 'id': '%d-%s' % (s['BandId'], s['$id']),
48 'title': s['Title'],
49 'uploader_id': playlist_id,
50 'uploader': s.get('BandName', playlist_id),
51 'thumbnail': 'http://urort.p3.no/cloud/images/%s' % s['Image'],
52 'upload_date': unified_strdate(s.get('Released')),
53 'formats': formats,
54 }
55 entries.append(e)
e2b06e76
PH
56
57 return {
58 '_type': 'playlist',
59 'id': playlist_id,
60 'title': playlist_id,
61 'entries': entries,
62 }