[ie/urort] implement tests

Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
This commit is contained in:
Moritz Barsnick 2025-10-01 11:42:45 +02:00
parent 3c8d9f8b3a
commit e814d07910

View file

@ -15,23 +15,28 @@ class UrortPlaylistIE(InfoExtractor):
IE_DESC = 'NRK P3 Urørt Playlist'
_VALID_URL = r'https?://(?:www\.)?urort\.p3\.no/(?:artist|playlist)/(?P<id>[^/?#]+)$'
# FIXME: make a proper playlist test
_TEST = {
_TESTS = [{
'note': 'artist playlist',
'url': 'https://urort.p3.no/artist/Gerilja',
'md5': '5ed31a924be8a05e47812678a86e127b',
'info_dict': {
'id': '33124-24',
'ext': 'mp3',
'title': 'The Bomb',
'thumbnail': r're:^https?://.+\.jpg',
'uploader': 'Gerilja',
'uploader_id': 'Gerilja',
'upload_date': '20100323',
'id': '1355',
'ext': 'm4a',
'title': 'Gerilja: Animals (radio edit)',
'thumbnail': r're:^https?://.+\.(jpg|png]',
},
'params': {
'matchtitle': '^The Bomb$', # To test, we want just one video
'matchtitle': '^Gerilja', # To test, we want just one video
},
}
}, {
'note': 'track playlist',
'url': 'https://urort.p3.no/playlist/rock',
'info_dict': {
'id': str,
'title': str,
},
'playlist_count': 100,
}]
def _real_extract(self, url):
playlist_id = self._match_id(url)
@ -63,22 +68,40 @@ class UrortIE(InfoExtractor):
IE_DESC = 'NRK P3 Urørt'
_VALID_URL = r'https?://(?:www\.)?urort\.p3\.no/track/[^/]+/(?P<id>[^/&?#$]+)'
_TEST = {
_TESTS = [{
'note': 'MP4 AAC and default empty PNG thunbnail',
'url': 'https://urort.p3.no/track/Gerilja/the-bomb',
'md5': '5ed31a924be8a05e47812678a86e127b',
'md5': '9eee22c88598e285a3b4fa06ac387f79',
'info_dict': {
'id': '33124-24',
'id': '1356',
'display_id': 'the-bomb',
'ext': 'm4a',
'title': 'Gerilja: The Bomb',
'thumbnail': r're:^https?://.+\.(jpg|png)',
},
}, {
'note': 'MP3 and custom thunbnail',
'url': 'https://urort.p3.no/track/lokal-politikk/svarteper-1',
'md5': 'b9cc2b97820016a89b1140f11cf78fac',
'info_dict': {
'id': '191567',
'display_id': 'svarteper-1',
'ext': 'mp3',
'title': 'The Bomb',
'thumbnail': r're:^https?://.+\.jpg',
'uploader': 'Gerilja',
'uploader_id': 'Gerilja',
'upload_date': '20100323',
'title': 'Lokal Politikk : Svarteper',
'thumbnail': r're:^https?://',
},
'params': {
'matchtitle': '^The Bomb$', # To test, we want just one video
}, {
'note': 'WAV and custom thunbnail',
'url': 'https://urort.p3.no/track/girl-group/shut-your-mouth-sometimes',
'md5': '625873985ccdbbc37d05078d8927a522',
'info_dict': {
'id': '224148',
'display_id': 'shut-your-mouth-sometimes',
'ext': 'wav',
'title': 'Girl Group: Shut Your Mouth (Sometimes) ',
'thumbnail': r're:^https?://',
},
}
}]
def _real_extract(self, url):
title_id = self._match_id(url)