mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-27 09:41:26 +01:00
Compare commits
No commits in common. "c9604eb61267c98628f094ed5061933bc624adea" and "91ca560381165969194fb04e764782d720816f74" have entirely different histories.
c9604eb612
...
91ca560381
|
@ -36,39 +36,29 @@ class JioSaavnSongIE(JioSaavnBaseIE):
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
audio_id = self._match_id(url)
|
audio_id = self._match_id(url)
|
||||||
song_data = self._extract_initial_data(url, audio_id)['song']['song']
|
song_data = self._extract_initial_data(url, audio_id)['song']['song']
|
||||||
formats = []
|
media_data = self._download_json(
|
||||||
# available bitrates are 16, 32, 64, 128, 320
|
'https://www.jiosaavn.com/api.php', audio_id, data=urlencode_postdata({
|
||||||
for bitrate in self._configuration_arg('bitrate', ['16', '32', '64', '128', '320'], ie_key='JioSaavn'):
|
'__call': 'song.generateAuthToken',
|
||||||
media_data = self._download_json(
|
'_format': 'json',
|
||||||
'https://www.jiosaavn.com/api.php', audio_id, f'Downloading format info for {bitrate}',
|
'bitrate': '320',
|
||||||
fatal=False, data=urlencode_postdata({
|
'url': song_data['encrypted_media_url'],
|
||||||
'__call': 'song.generateAuthToken',
|
}))
|
||||||
'_format': 'json',
|
|
||||||
'bitrate': bitrate,
|
return {
|
||||||
'url': song_data['encrypted_media_url'],
|
'id': audio_id,
|
||||||
}))
|
'url': media_data['auth_url'],
|
||||||
if not media_data.get('auth_url'):
|
'ext': media_data.get('type'),
|
||||||
self.report_warning(f'Unable to extract format info for {bitrate}')
|
'vcodec': 'none',
|
||||||
continue
|
**traverse_obj(song_data, {
|
||||||
formats.append({
|
'title': ('title', 'text'),
|
||||||
'url': media_data['auth_url'],
|
'album': ('album', 'text'),
|
||||||
'ext': media_data.get('type'),
|
'thumbnail': ('image', 0, {url_or_none}),
|
||||||
'id': bitrate,
|
}),
|
||||||
'format_id': bitrate,
|
}
|
||||||
'abr': int(bitrate),
|
|
||||||
'vcodec': 'none',
|
|
||||||
'acodec': media_data.get('type'),
|
|
||||||
**traverse_obj(song_data, {
|
|
||||||
'title': ('title', 'text'),
|
|
||||||
'album': ('album', 'text'),
|
|
||||||
'thumbnail': ('image', 0, {url_or_none}),
|
|
||||||
}),
|
|
||||||
})
|
|
||||||
return self.playlist_result(formats)
|
|
||||||
|
|
||||||
|
|
||||||
class JioSaavnAlbumIE(JioSaavnBaseIE):
|
class JioSaavnAlbumIE(JioSaavnBaseIE):
|
||||||
_VALID_URL = r'https?://(?:www\.)?(?:jio)?saavn\.com/(?:s/playlist|album)/[^/?#]+/(?P<id>[^/?#]+)'
|
_VALID_URL = r'https?://(?:www\.)?(?:jio)?saavn\.com/album/[^/?#]+/(?P<id>[^/?#]+)'
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
'url': 'https://www.jiosaavn.com/album/96/buIOjYZDrNA_',
|
'url': 'https://www.jiosaavn.com/album/96/buIOjYZDrNA_',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user