This commit is contained in:
Ronni 2024-07-28 01:38:28 +09:00 committed by GitHub
commit 9b4ce9f61f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 50 additions and 0 deletions

View File

@ -0,0 +1,48 @@
# coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
class ErocastIE(InfoExtractor):
IE_NAME = 'erocast'
_VALID_URL = r'https?://(?:www\.)?erocast\.me/track/(?P<id>[0-9]+)/(?P<display_id>[0-9a-zA-Z_-]+)'
_TEST = {
'url': 'https://erocast.me/track/6508/piano-sample-by-ytdl',
'md5': '6764726b2d19161e93c9cf3a9a69800a',
'info_dict': {
'id': '6508',
'ext': 'mp4',
'title': 'Piano sample by ytdl',
'uploader': 'ytdl',
}
}
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
# The Song data is in a script tag with the following format:
# (see https://github.com/ytdl-org/youtube-dl/issues/31203#issuecomment-1259867716)
searchPattern = r'<script>var song_data_' + str(video_id) + r' = (.+?)<\/script>'
jsonString = self._html_search_regex(searchPattern, webpage, 'data')
# The data is in JSON format, so we convert the JSON String to a python object
# and read the data from this json object
jsonObject = self._parse_json(jsonString, None, fatal=False)
audio_url = jsonObject['stream_url']
title = jsonObject['title']
user_name = jsonObject['user']['name']
# The audio url is a m3u8 playlist, so we extract the audio url from this playlist
formats = []
formats.extend(self._extract_m3u8_formats(
audio_url, video_id, 'mp4', 'm3u8_native',
m3u8_id='hls', fatal=False))
return {
'id': video_id,
'formats': formats,
'title': title,
'uploader': user_name,
}

View File

@ -360,6 +360,8 @@ from .embedly import EmbedlyIE
from .engadget import EngadgetIE
from .epidemicsound import EpidemicSoundIE
from .eporner import EpornerIE
from .erocast import ErocastIE
from .eroprofile import EroProfileIE
from .escapist import EscapistIE
from .espn import (