From 00869c4d5757a56dc0a89fae6272e608cfc12aa1 Mon Sep 17 00:00:00 2001 From: "J.Luis" Date: Thu, 27 Mar 2025 23:12:34 +0100 Subject: [PATCH] [ivoox] Add extractor --- supportedsites.md | 1 + yt_dlp/extractor/_extractors.py | 1 + yt_dlp/extractor/ivoox.py | 81 +++++++++++++++++++++++++++++++++ 3 files changed, 83 insertions(+) create mode 100644 yt_dlp/extractor/ivoox.py diff --git a/supportedsites.md b/supportedsites.md index 4a0e7519a6..c35b681cb4 100644 --- a/supportedsites.md +++ b/supportedsites.md @@ -633,6 +633,7 @@ The only reliable way to check if a site is supported is to try it. - **ivi**: ivi.ru - **ivi:compilation**: ivi.ru compilations - **ivideon**: Ivideon TV + - **iVoox** - **IVXPlayer** - **iwara**: [*iwara*](## "netrc machine") - **iwara:playlist**: [*iwara*](## "netrc machine") diff --git a/yt_dlp/extractor/_extractors.py b/yt_dlp/extractor/_extractors.py index a44601b14d..16af868571 100644 --- a/yt_dlp/extractor/_extractors.py +++ b/yt_dlp/extractor/_extractors.py @@ -902,6 +902,7 @@ from .ivi import ( IviIE, ) from .ivideon import IvideonIE +from .ivoox import IvooxIE from .iwara import ( IwaraIE, IwaraPlaylistIE, diff --git a/yt_dlp/extractor/ivoox.py b/yt_dlp/extractor/ivoox.py new file mode 100644 index 0000000000..c001b4018e --- /dev/null +++ b/yt_dlp/extractor/ivoox.py @@ -0,0 +1,81 @@ +from .common import InfoExtractor +from datetime import datetime +import json + +class IvooxIE(InfoExtractor): + _VALID_URL = ( + r'https?://(?:www\.)?ivoox\.com/.*_rf_(?P[0-9]+)_1\.html', + r'https?://go\.ivoox\.com/rf/(?P[0-9]+)' + ) + _TESTS = [ + { + 'url': 'https://www.ivoox.com/dex-08x30-rostros-del-mal-los-asesinos-en-audios-mp3_rf_143594959_1.html', + 'md5': 'f3cc6b8db8995e0c95604deb6a8f0f2f', + 'info_dict': { + # For videos, only the 'id' and 'ext' fields are required to RUN the test: + 'id': '143594959', + 'ext': 'mp3', + 'timestamp': 1742727600, + 'author': 'Santiago Camacho', + 'channel': 'DIAS EXTRAÑOS con Santiago Camacho', + 'title': 'DEx 08x30 Rostros del mal: Los asesinos en serie que aterrorizaron España', + } + }, + { + 'url': 'https://go.ivoox.com/rf/143594959', + 'md5': 'f3cc6b8db8995e0c95604deb6a8f0f2f', + 'info_dict': { + # For videos, only the 'id' and 'ext' fields are required to RUN the test: + 'id': '143594959', + 'ext': 'mp3', + 'timestamp': 1742727600, + 'author': 'Santiago Camacho', + 'channel': 'DIAS EXTRAÑOS con Santiago Camacho', + 'title': 'DEx 08x30 Rostros del mal: Los asesinos en serie que aterrorizaron España', + } + }, + ] + + def _real_extract(self, url): + media_id = self._match_id(url) + webpage = self._download_webpage(url, media_id) + + # Extract the podcast info + date = datetime.fromisoformat(self._html_search_regex(r'data-prm-pubdate="(.+?)"', webpage, 'title')) + timestamp = int(datetime.timestamp(date)) + author = self._html_search_regex(r'data-prm-author="(.+?)"', webpage, 'title') + podcast = self._html_search_regex(r'data-prm-podname="(.+?)"', webpage, 'title') + title = self._html_search_regex(r'data-prm-title="(.+?)"', webpage, 'title') + + # Extract the download URL + headers={ + 'Accept': 'application/json, text/plain, */*', + 'Accept-Encoding': 'identity', + 'Origin': 'https://www.ivoox.com', + 'Referer': 'https://www.ivoox.com/', + 'Priority': 'u=1, i' + } + metadata_url = f'https://vcore-web.ivoox.com/v1/public/audios/{media_id}/download-url' + download_json = self._download_json(metadata_url, media_id, headers=headers) + download_url = download_json['data']['downloadUrl'] + url = f'https://ivoox.com{download_url}' + + # Formats + formats = [ + { + 'url': url, + 'ext': 'mp3', + 'format_id': 'mp3_default', + 'http_headers': headers + } + ] + + return { + 'id': media_id, + 'title': title, + 'uploader': author, + 'channel': podcast, + 'timestamp': timestamp, + 'description': self._og_search_description(webpage), + 'formats': formats, + } \ No newline at end of file