script to download the first result in a yt search

This commit is contained in:
Jorge Vásquez Pérez
2019-05-03 01:22:39 -07:00
parent 4beb0730d2
commit 7d05d55c92
Executable
+10
View File
@@ -0,0 +1,10 @@
qurl="https://www.youtube.com/results?search_query="
qstring="Octonauts Poison Dart Frogs"
for i;
do temp=$(curl -s $qurl$(echo $i | sed 's/\s/+/g') | grep -o href\=\"\/watch\?v\=[^\"]* | head -1)
code=$(echo $temp | sed 's/href\=\"\/watch\>?v\=//')
echo $code
youtube-dl -f bestvideo+bestaudio "https://www.youtube.com/watch?v="$code
done;