Compare commits

...

5 Commits

Author SHA1 Message Date
alien-developers
c9604eb612
Update jiosaavn.py 2023-12-25 12:12:42 +05:30
alien-developers
95eba9eebb
Update jiosaavn.py
Adjusted white spaces
2023-12-25 09:13:25 +05:30
alien-developers
73e4497ebe
Update jiosaavn.py 2023-12-25 09:08:38 +05:30
alien-developers
dc7c9a615e
Update jiosaavn.py 2023-12-25 09:05:24 +05:30
alien-developers
2fde65749b
Update jiosaavn.py
updated jiosaavn to get all formats. Please follow the below instructions to download the songs in certain format.

# available bitrates are 16, 32, 64, 128, 320
 --match-filter "abr = bitrate"
Eg:  --match-filter "abr = 128"

Also, you can use below output format to create folder for each album.

Windows: 
-o %(album)s/%(title)s.%(ext)s
2023-12-25 08:48:27 +05:30

View File

@ -36,29 +36,39 @@ 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']
media_data = self._download_json( formats = []
'https://www.jiosaavn.com/api.php', audio_id, data=urlencode_postdata({ # available bitrates are 16, 32, 64, 128, 320
'__call': 'song.generateAuthToken', for bitrate in self._configuration_arg('bitrate', ['16', '32', '64', '128', '320'], ie_key='JioSaavn'):
'_format': 'json', media_data = self._download_json(
'bitrate': '320', 'https://www.jiosaavn.com/api.php', audio_id, f'Downloading format info for {bitrate}',
'url': song_data['encrypted_media_url'], fatal=False, data=urlencode_postdata({
})) '__call': 'song.generateAuthToken',
'_format': 'json',
return { 'bitrate': bitrate,
'id': audio_id, 'url': song_data['encrypted_media_url'],
'url': media_data['auth_url'], }))
'ext': media_data.get('type'), if not media_data.get('auth_url'):
'vcodec': 'none', self.report_warning(f'Unable to extract format info for {bitrate}')
**traverse_obj(song_data, { continue
'title': ('title', 'text'), formats.append({
'album': ('album', 'text'), 'url': media_data['auth_url'],
'thumbnail': ('image', 0, {url_or_none}), 'ext': media_data.get('type'),
}), '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/album/[^/?#]+/(?P<id>[^/?#]+)' _VALID_URL = r'https?://(?:www\.)?(?:jio)?saavn\.com/(?:s/playlist|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': {