From 47c598783c98c179e04dd12c2a3fee0f3dc53087 Mon Sep 17 00:00:00 2001 From: Esme Date: Fri, 6 Oct 2023 17:58:28 -0500 Subject: [PATCH] [ie/erocast] Add extractor (#8264) Closes #4001 Authored by: madewokherd --- yt_dlp/extractor/_extractors.py | 1 + yt_dlp/extractor/erocast.py | 63 +++++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 yt_dlp/extractor/erocast.py diff --git a/yt_dlp/extractor/_extractors.py b/yt_dlp/extractor/_extractors.py index ef6123e8a..b10ef2f33 100644 --- a/yt_dlp/extractor/_extractors.py +++ b/yt_dlp/extractor/_extractors.py @@ -574,6 +574,7 @@ from .eplus import EplusIbIE from .epoch import EpochIE from .eporner import EpornerIE +from .erocast import ErocastIE from .eroprofile import ( EroProfileIE, EroProfileAlbumIE, diff --git a/yt_dlp/extractor/erocast.py b/yt_dlp/extractor/erocast.py new file mode 100644 index 000000000..92a57536c --- /dev/null +++ b/yt_dlp/extractor/erocast.py @@ -0,0 +1,63 @@ +from .common import InfoExtractor +from ..utils import ( + int_or_none, + parse_iso8601, + str_or_none, + traverse_obj, + url_or_none, +) + + +class ErocastIE(InfoExtractor): + _VALID_URL = r'https?://(?:www\.)?erocast\.me/track/(?P[0-9]+)' + _TESTS = [{ + 'url': 'https://erocast.me/track/9787/f', + 'md5': 'af63b91f5f231096aba54dd682abea3b', + 'info_dict': { + 'id': '9787', + 'title': '[F4M] Your roommate, who is definitely not possessed by an alien, suddenly wants to fuck you', + 'url': 'https://erocast.s3.us-east-2.wasabisys.com/1220419/track.m3u8', + 'ext': 'm4a', + 'age_limit': 18, + 'release_timestamp': 1696178652, + 'release_date': '20231001', + 'modified_timestamp': int, + 'modified_date': str, + 'description': 'ExtraTerrestrial Tuesday!', + 'uploader': 'clarissaisshy', + 'uploader_id': '8113', + 'uploader_url': 'https://erocast.me/clarissaisshy', + 'thumbnail': 'https://erocast.s3.us-east-2.wasabisys.com/1220418/conversions/1696179247-lg.jpg', + 'duration': 2307, + 'view_count': int, + 'comment_count': int, + 'webpage_url': 'https://erocast.me/track/9787/f4m-your-roommate-who-is-definitely-not-possessed-by-an-alien-suddenly-wants-to-fuck-you', + } + }] + + def _real_extract(self, url): + video_id = self._match_id(url) + webpage = self._download_webpage(url, video_id) + data = self._search_json( + rf'') + + return { + 'id': video_id, + 'formats': self._extract_m3u8_formats( + data.get('file_url') or data['stream_url'], video_id, 'm4a', m3u8_id='hls'), + 'age_limit': 18, + **traverse_obj(data, { + 'title': ('title', {str}), + 'description': ('description', {str}), + 'release_timestamp': ('created_at', {parse_iso8601}), + 'modified_timestamp': ('updated_at', {parse_iso8601}), + 'uploader': ('user', 'name', {str}), + 'uploader_id': ('user', 'id', {str_or_none}), + 'uploader_url': ('user', 'permalink_url', {url_or_none}), + 'thumbnail': ('artwork_url', {url_or_none}), + 'duration': ('duration', {int_or_none}), + 'view_count': ('plays', {int_or_none}), + 'comment_count': ('comment_count', {int_or_none}), + 'webpage_url': ('permalink_url', {url_or_none}), + }), + }