mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-09-22 10:21:24 +02:00
Compare commits
No commits in common. "a4dc13ccc39bf44959b6e6346f9a36c80a9cca35" and "e0c3428bcba877f9ec7c26eb8919ae0e3630e965" have entirely different histories.
a4dc13ccc3
...
e0c3428bcb
|
@ -17,64 +17,46 @@ from ..utils.traversal import traverse_obj
|
||||||
|
|
||||||
|
|
||||||
class RadioComercialIE(InfoExtractor):
|
class RadioComercialIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?radiocomercial\.pt/podcasts/[^/]+/\D*(?P<season>\d+)/(?P<id>[\w-]+)'
|
_VALID_URL = r'https?://(?:www\.)?radiocomercial\.pt/podcasts/[^/]+/\w(?P<season>\d+)/(?P<id>[-\w]+)/*$'
|
||||||
_TESTS = [
|
_TESTS = [{
|
||||||
|
'url': 'https://radiocomercial.pt/podcasts/o-homem-que-mordeu-o-cao/t6/taylor-swift-entranhando-se-que-nem-uma-espada-no-ventre-dos-fas',
|
||||||
|
'md5': '5f4fe8e485b29d2e8fd495605bc2c7e4',
|
||||||
|
'info_dict': {
|
||||||
|
'id': 'taylor-swift-entranhando-se-que-nem-uma-espada-no-ventre-dos-fas',
|
||||||
|
'ext': 'mp3',
|
||||||
|
'title': 'Taylor Swift entranhando-se que nem uma espada no ventre dos fãs.',
|
||||||
|
'description': '',
|
||||||
|
'release_date': '20231025',
|
||||||
|
'thumbnail': r're:https://radiocomercial.pt/upload/[^.]+.jpg',
|
||||||
|
'season': 6
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
'url': 'https://radiocomercial.pt/podcasts/o-homem-que-mordeu-o-cao/t6/taylor-swift-entranhando-se-que-nem-uma-espada-no-ventre-dos-fas',
|
'url': 'https://radiocomercial.pt/podcasts/convenca-me-num-minuto/t3/convenca-me-num-minuto-que-os-lobisomens-existem',
|
||||||
'md5': '5f4fe8e485b29d2e8fd495605bc2c7e4',
|
'md5': '47e96c273aef96a8eb160cd6cf46d782',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'taylor-swift-entranhando-se-que-nem-uma-espada-no-ventre-dos-fas',
|
'id': 'convenca-me-num-minuto-que-os-lobisomens-existem',
|
||||||
'ext': 'mp3',
|
'ext': 'mp3',
|
||||||
'title': 'Taylor Swift entranhando-se que nem uma espada no ventre dos fãs.',
|
'title': 'Convença-me num minuto que os lobisomens existem',
|
||||||
'description': None,
|
'description': '',
|
||||||
'release_date': '20231025',
|
'release_date': '20231026',
|
||||||
'thumbnail': r're:https://radiocomercial.pt/upload/[^.]+.jpg',
|
'thumbnail': r're:https://radiocomercial.pt/upload/[^.]+.jpg',
|
||||||
'season': 6
|
'season': 3
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'url': 'https://radiocomercial.pt/podcasts/convenca-me-num-minuto/t3/convenca-me-num-minuto-que-os-lobisomens-existem',
|
'url': 'https://radiocomercial.pt/podcasts/inacreditavel-by-ines-castel-branco/t2/o-desastre-de-aviao',
|
||||||
'md5': '47e96c273aef96a8eb160cd6cf46d782',
|
'md5': '69be64255420fec23b7259955d771e54',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
'id': 'convenca-me-num-minuto-que-os-lobisomens-existem',
|
'id': 'o-desastre-de-aviao',
|
||||||
'ext': 'mp3',
|
'ext': 'mp3',
|
||||||
'title': 'Convença-me num minuto que os lobisomens existem',
|
'title': 'O desastre de avião',
|
||||||
'description': None,
|
'description': 'md5:8a82beeb372641614772baab7246245f',
|
||||||
'release_date': '20231026',
|
'release_date': '20231101',
|
||||||
'thumbnail': r're:https://radiocomercial.pt/upload/[^.]+.jpg',
|
'thumbnail': r're:https://radiocomercial.pt/upload/[^.]+.jpg',
|
||||||
'season': 3
|
'season': 2
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
'url': 'https://radiocomercial.pt/podcasts/inacreditavel-by-ines-castel-branco/t2/o-desastre-de-aviao',
|
|
||||||
'md5': '69be64255420fec23b7259955d771e54',
|
|
||||||
'info_dict': {
|
|
||||||
'id': 'o-desastre-de-aviao',
|
|
||||||
'ext': 'mp3',
|
|
||||||
'title': 'O desastre de avião',
|
|
||||||
'description': 'md5:8a82beeb372641614772baab7246245f',
|
|
||||||
'release_date': '20231101',
|
|
||||||
'thumbnail': r're:https://radiocomercial.pt/upload/[^.]+.jpg',
|
|
||||||
'season': 2
|
|
||||||
},
|
|
||||||
'params': {
|
|
||||||
# inconsistant md5
|
|
||||||
'skip_download': True,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
'url': 'https://radiocomercial.pt/podcasts/tnt-todos-no-top/2023/t-n-t-29-de-outubro',
|
|
||||||
'md5': '91d32d4d4b1407272068b102730fc9fa',
|
|
||||||
'info_dict': {
|
|
||||||
'id': 't-n-t-29-de-outubro',
|
|
||||||
'ext': 'mp3',
|
|
||||||
'title': 'T.N.T 29 de outubro',
|
|
||||||
'description': None,
|
|
||||||
'release_date': '20231029',
|
|
||||||
'thumbnail': r're:https://radiocomercial.pt/upload/[^.]+.jpg',
|
|
||||||
'season': 2023
|
|
||||||
}
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
|
@ -83,7 +65,7 @@ class RadioComercialIE(InfoExtractor):
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': self._html_extract_title(webpage),
|
'title': self._html_extract_title(webpage),
|
||||||
'description': self._og_search_description(webpage, default=None),
|
'description': self._og_search_description(webpage, default=''),
|
||||||
'release_date': unified_strdate(
|
'release_date': unified_strdate(
|
||||||
get_element_by_class('date', get_element_html_by_class('descriptions', webpage))),
|
get_element_by_class('date', get_element_html_by_class('descriptions', webpage))),
|
||||||
'thumbnail': self._og_search_thumbnail(webpage),
|
'thumbnail': self._og_search_thumbnail(webpage),
|
||||||
|
@ -93,52 +75,49 @@ class RadioComercialIE(InfoExtractor):
|
||||||
|
|
||||||
|
|
||||||
class RadioComercialPlaylistIE(InfoExtractor):
|
class RadioComercialPlaylistIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://(?:www\.)?radiocomercial\.pt/podcasts/(?P<id>[\w-]+)(?:\D*(?P<season>\d+))?'
|
_VALID_URL = r'https?://(?:www\.)?radiocomercial\.pt/podcasts/(?P<id>[-\w]+)[/\w\d+]*$'
|
||||||
_PAGE_SIZE = 19
|
_PAGE_SIZE = 19
|
||||||
_TESTS = [
|
_TESTS = [{
|
||||||
{
|
'url': 'https://radiocomercial.pt/podcasts/convenca-me-num-minuto/t3',
|
||||||
'url': 'https://radiocomercial.pt/podcasts/convenca-me-num-minuto/t3',
|
'info_dict': {
|
||||||
'info_dict': {
|
'id': 'convenca-me-num-minuto',
|
||||||
'id': 'convenca-me-num-minuto',
|
'title': 'Convença-me num Minuto - Temporada 3',
|
||||||
'title': 'Convença-me num Minuto - Temporada 3',
|
|
||||||
},
|
|
||||||
'playlist_mincount': 32
|
|
||||||
},
|
},
|
||||||
{
|
'playlist_mincount': 32
|
||||||
'url': 'https://radiocomercial.pt/podcasts/o-homem-que-mordeu-o-cao',
|
}, {
|
||||||
'info_dict': {
|
'url': 'https://radiocomercial.pt/podcasts/o-homem-que-mordeu-o-cao',
|
||||||
'id': 'o-homem-que-mordeu-o-cao',
|
'info_dict': {
|
||||||
'title': 'O Homem Que Mordeu o Cão',
|
'id': 'o-homem-que-mordeu-o-cao',
|
||||||
},
|
'title': 'O Homem Que Mordeu o Cão',
|
||||||
'playlist_mincount': 19
|
|
||||||
},
|
},
|
||||||
{
|
'playlist_mincount': 19
|
||||||
'url': 'https://radiocomercial.pt/podcasts/as-minhas-coisas-favoritas',
|
}, {
|
||||||
'info_dict': {
|
'url': 'https://radiocomercial.pt/podcasts/as-minhas-coisas-favoritas',
|
||||||
'id': 'as-minhas-coisas-favoritas',
|
'info_dict': {
|
||||||
'title': 'As Minhas Coisas Favoritas',
|
'id': 'as-minhas-coisas-favoritas',
|
||||||
},
|
'title': 'As Minhas Coisas Favoritas',
|
||||||
'playlist_mincount': 131
|
},
|
||||||
}
|
'playlist_mincount': 131
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
def _fetch_page(self, podcast, season, page):
|
def _fetch_page(self, url, season, page):
|
||||||
page += 1
|
page += 1
|
||||||
url = f'https://radiocomercial.pt/podcasts/{podcast}' + (f'/t{season}' if season else '') + f'/{page}'
|
next_page = f'{url}{"/" + str(page) if page > 1 else ""}'
|
||||||
playlist_id = join_nonempty(podcast, season, delim='_')
|
webpage = self._download_webpage(next_page, season, headers={'X-Requested-With': 'XMLHttpRequest'},
|
||||||
webpage = self._download_webpage(url, playlist_id, note=f'Downloading page: {page}')
|
note=f'Downloading page: {next_page}')
|
||||||
|
|
||||||
episodes = set(traverse_obj(get_elements_html_by_class('tm-ouvir-podcast', webpage),
|
episodes = set(traverse_obj(get_elements_html_by_class('tm-ouvir-podcast', webpage),
|
||||||
(..., {extract_attributes}, 'href')))
|
(..., {extract_attributes}, 'href')))
|
||||||
for entry in episodes:
|
for entry in episodes:
|
||||||
yield self.url_result(f'https://radiocomercial.pt{entry}', RadioComercialIE)
|
yield self.url_result(f'https://radiocomercial.pt{entry}', RadioComercialIE)
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
podcast, season = self._match_valid_url(url).group('id', 'season')
|
podcast = self._match_id(url)
|
||||||
webpage = self._download_webpage(url, podcast)
|
webpage = self._download_webpage(url, podcast)
|
||||||
|
|
||||||
name = try_call(lambda: get_element_text_and_html_by_tag('h1', webpage)[0])
|
name = try_call(lambda: get_element_text_and_html_by_tag('h1', webpage)[0])
|
||||||
title = name if name == season else join_nonempty(name, season, delim=' - Temporada ')
|
season = self._html_extract_title(webpage)
|
||||||
|
title = name if name == season else join_nonempty(name, season, delim=' - ')
|
||||||
|
|
||||||
return self.playlist_result(OnDemandPagedList(functools.partial(self._fetch_page, podcast, season),
|
return self.playlist_result(OnDemandPagedList(functools.partial(self._fetch_page, url, season),
|
||||||
self._PAGE_SIZE), podcast, title)
|
self._PAGE_SIZE), podcast, title)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user