https://xuexi-courses.firesbox.com/?utm_source=share#/7000102069/courses/

    1. curl -u clientId:clientSecret -X POST -d "username=test&password=test&grant_type=password&scope=read" http://www.example.com/oauth/token
    2. curl -s -H "Authorization: ${TOKEN}" https://xuexi-courses-api.firesbox.com/v1/courses?offset=0&limit=100&sort=oldest-first
    3. cat courses.json jq '.courses|.[] |.id' > id-0-200.url
    4. TOKEN="Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiIxNTkwNzciLCJleHAiOjE2NjUxMjU2MzgsImp0aSI6Ijk5NmRhOTE0LWI0ZjAtNDVkMC04ZDAxLTJjZWE0YzE4NjJlZSIsImlhdCI6MTY2NDUyMDgzOCwiaXNzIjoiMzAwMjIiLCJzdWIiOiI3MDAwMTAyMDY5IiwidWlkIjoiM2IyNGQ3ZWQtOTliOS00ODA2LTlhZWItZTY3YWVjYzEyOGJlIiwibW9kZSI6ImNsaWVudCIsInR5cCI6ImFwcHVzZXIiLCJvYXAiOiJtaXhpbiIsInNpZCI6ImY5ODEwODM0ZmNkODRiZTk4NzQyYTM3YmY4MTYxMzkwIn0.wXhhf0yHB_8z9lTlkNos9NOZfZg2xcxl3rUtEvm2tTk"
    5. curl -s -H "Authorization: ${TOKEN}" https://xuexi-courses-api.firesbox.com/v1/courses/ |jq '.courses | .[] | .id ' >IDS.txt
    6. mkdir output
    7. for ID in `cat IDS.txt`
    8. do
    9. echo $ID
    10. TITLE=`curl -s -H "Authorization: ${TOKEN}" https://xuexi-courses-api.firesbox.com/v1/courses/$ID |jq '.title'| sed 's/\"//g'`
    11. if [ ! -f "output/$TITLE.mp3" ]; then
    12. if [[ $TITLE == * ]];
    13. then
    14. echo $TITLE
    15. curl -s -H "Authorization: ${TOKEN}" https://xuexi-courses-api.firesbox.com/v1/courses/$ID/messages |jq '.[] | .attachment | .url'| sed 's/\"//g' |grep -v null|grep mp3> url.txt
    16. cat url.txt
    17. rm -rf *.mp3
    18. cat -n url.txt | awk '{print "wget -c " $2 " -O " $1 ".mp3"}' > rename.sh
    19. sh rename.sh
    20. ALL=`cat -n url.txt | awk '{print $1 ".mp3"}'|tr '\n' '|'|sed s'/.$//'`
    21. ffmpeg -y -i "concat:$ALL" -acodec copy output/$TITLE.mp3
    22. ll output/$TITLE.mp3
    23. rm -rf *.mp3
    24. fi
    25. fi
    26. done
    27. rm -rf url.txt rename.sh IDS.txt