TE
科技回声
首页
24小时热榜
最新
最佳
问答
展示
工作
中文
GitHub
Twitter
首页
Show HN: Sed-based YouTube dl
4 点
作者
101914
将近 8 年前
<p><pre><code> test $# = 1|| exec echo usage: $0 itag-no sed -n ' s/http:/https:/; s/m.youtube/www.youtube/; s/youtu.be/youtube/; s/embed./watch?v=/; #etc.; s/;.*//; w.'"$0"'' read a < .$0; rm .$0; n=0;while true;do curl -so .$0a $a; unset a; # is tr needed probably not tr -cd '\12\40-\176' < .$0a \ |exec sed ' s/https%3A/\ &/g; s/ *//; /https%3A%2F%2F/!d; s/%3A/:/g; s/%2C/,/g; s/%2F/\//g; s/%3D/=/g; s/%3B/;/g; s/%3F/?/g; s/%26/\&/g; s/\\u0026/\&/g; s/%252C/,/g; s/%252F/\//g; s/%22/\"/g; s/%255B/[/g; s/%255D/]/g; ' \ |exec sed ' /itag='"$1"'/!d; #change if dont want mp4 /video.mp4/!d; #change if want webm /webm/d; /ytplayer/d; s/;+codecs.*//; /timedtext/d; ' > .$0b; rm .$0a; read b < .$0b; rm .$0b; test ${#b} = 0||break #number of retries default is 10 test $n -le 9||exit n=$((n+1)); done exec curl -o 1.mp4 $b #unset b</code></pre>
暂无评论
暂无评论