Created
January 28, 2015 06:59
-
-
Save lrvick/fffb8f5c31468ac24c1f to your computer and use it in GitHub Desktop.
Youtube batch browserless search/autoplay script I wrote ages ago. Probably no longer works.
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/bash | |
#YouTubeSucker 0.9999999423ish | |
#your media player and args of choice, must have flv support, mplayer or vlc will do the job | |
mediap="mplayer -fs" | |
terms="$*" | |
if [ "$terms" = "" ] ; then | |
echo 'Usage: yts.sh [YouTube URL] [search terms]' | |
fi | |
if [[ `echo ${terms} | grep youtube.com` ]] ; then | |
echo "http://youtube.com/get_video.php?"`curl -s $1 | grep "watch_fullscreen" | sed "s;.*\(video_id.\+\)&title.*;\1;"` | |
exit | |
fi | |
terms=`echo ${terms}| tr ' ' '+'` | |
search=`curl -s "http://youtube.com/results?search_query=${terms}&search=Search"| grep watch?` | |
results=`for line in ${search} ;do echo $line| grep href | sed -e 's#href="/watch?v=##g;s#"##';done` | |
results=`echo ${results} | sed -e 's/ /\n/g' | uniq` | |
for id in ${results} ; | |
do | |
realid=`curl -s http://youtube.com/watch?v=${id} | grep "watch_fullscreen" | sed "s;.*\(video_id.\+\)&title.*;\1;"` | |
tubeline="$tubeline http://youtube.com/get_video.php?${realid}" | |
done | |
${mediap} \"${tubeline}\" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment