Skip to content

Instantly share code, notes, and snippets.

@yuzebin
Created June 15, 2018 07:12
Show Gist options
  • Save yuzebin/81e228b51e1ec6af5cbce3f8a184407a to your computer and use it in GitHub Desktop.
Save yuzebin/81e228b51e1ec6af5cbce3f8a184407a to your computer and use it in GitHub Desktop.
网易公开课单视频下载脚本
#!/usr/bin/env bash
# author: yuzebin AT gmail
# 20180614
# open163_dl_single.sh
main() {
curl -A "Mozilla/5.0 (iPad; CPU iPhone OS 11_0 like Mac OS X) AppleWebKit/604.1.38 (KHTML, like Gecko) Version/11.0 Mobile/15A372 Safari/604.1" $1 | grep -ohE "https?://[a-zA-Z0-9\.\/_&=@$?~#-]*" | grep m3u8 | xargs -I{} ffmpeg -i {} -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $2.mp4
}
if [[ $# -ne 2 ]]; then
echo "Install: brew install enca ffmpeg curl"
echo "Usage : $0 single_video_url single_video_name"
echo "Example: $0 https://open.163.com/movie/2015/12/F/S/MB928OJG7_MB929K3FS.html 学校不敢教的酷炫科学实验"
else
main $1 $2
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment