Last active
April 7, 2017 08:36
-
-
Save hnq90/38eaa792ad1f19df6f88345477c5badb to your computer and use it in GitHub Desktop.
Download 320Kbps song from mp3.zing.vn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
songId=$1 | |
parseJson () { | |
python -c "import json,sys;sys.stdout.write(json.dumps(json.load(sys.stdin)$1))"; | |
} | |
fetch () { | |
local output=`wget -q --method GET --progress=dot --output-document - http://api.mp3.zing.vn/api/mobile/song/getsonginfo?requestdata={\"id\":\"$songId\"}` | |
local link=$(echo $output | parseJson "['source']['320']") | |
local artist=$(echo $output | parseJson "['artist']") | |
local title=$(echo $output | parseJson "['title']") | |
link="${link%\"}" | |
link="${link#\"}" | |
title="${title%\"}" | |
title="${title#\"}" | |
artist="${artist%\"}" | |
artist="${artist#\"}" | |
local fileName=`echo "$(echo -e $title)_$(echo -e $artist)_320kbps"` | |
wget --method GET \ | |
--header 'cache-control: no-cache' \ | |
--output-document="$fileName.mp3" \ | |
- $link | |
} | |
fetch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment