naqushab / saavn-downloader-extension

Chrome Extension to download songs and block ads for jiosaavn.com (previously saavn.com)
https://www.jiosaavn.com/
91 stars 18 forks source link

Fallback to next best quality of song if a song is not available in a particular download quality #21

Closed naqushab closed 4 years ago

naqushab commented 5 years ago

The reason that some songs are of few KBs in size is because they are not available in selected quality (320kbps for example). There is no way to see if a song is available in a mentioned quality for now. Playlist and Albums can have such songs will will lead to having such files in them too.

If we can fallback to next best quality that is available to download, it will solve this problem.

dharmendra98 commented 5 years ago

I think i can give it a try.

naqushab commented 5 years ago

I would really appreciate the effort. Raise a PR for it whenever you can.

On Thu, Aug 29, 2019, 11:32 AM Dharmendra notifications@github.com wrote:

I think i can give it a try.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/naqushab/saavn-downloader-extension/issues/21?email_source=notifications&email_token=ABUAKXULJLXQJGFSOTJA3XDQG5Q5PA5CNFSM4H2B3Z3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5NLCWY#issuecomment-526037339, or mute the thread https://github.com/notifications/unsubscribe-auth/ABUAKXUHPSRGL6AIALQCATLQG5Q5PANCNFSM4H2B3Z3A .

HritwikSinghal commented 4 years ago

if status code of song download url doesn't return 200, replace '_320.mp3" with '.mp3'. This downloads song with 128kbps quality

naqushab commented 4 years ago

Good catch @HritwikSinghal . I'll add that as a part of the code

HritwikSinghal commented 4 years ago

Good catch @HritwikSinghal . I'll add that as a part of the code

Instead of directly falling back to 128, you can first try 160 (by replacing '_320' with "_160" , then fall back to 128 if 160 is not there. And if you are using 'h.saavncdn.com', then code 200 Will not be returned, instead code for redirection will be returned (dont remember it), so check these conditions also