this is a simple string match youtube search in bash. it uses both local database of 50 million videos metadata, as well as invidious api to query and append latest videos
ytsearch "search term"
ytrecommend
ytsearch "house mix" | head -n 3
https://youtube.com/watch?v=cBFZ10Lae2A You Don't Know Ya Salam - Todd Royce,House Mix Insane Rework,,t,t,,{}
https://youtube.com/watch?v=o115rpwEMfc Ya Salam ( House Version ) - Todd Royce,House Mix Insane Rework,,t,t,,{}
https://youtube.com/watch?v=3YYBKDWeJo0 DJ CDP.wmv,ATLANTA'S DYNAMIC DJ SERVICE DEMO MIX. GOSPEL HOUSE MIX,,t,t,,{}
download youtube scraping data dump (50 million videos metadata): https://github.com/111111111111111111111111111111111111110/ytsearch/raw/main/video_crawler_scrape.torrent
append code to .bashrc:
function ytlinks(){
cat | grep -i -m 100 --color "$1" | while read -r l
do
echo "$l" | cut -c '1-11' | awk '{printf "https://youtube.com/watch?v="$1" "}'
echo "$l" | cut -c '13-' | grep -i --color "$1"
done
}
function ytsearch(){
cat ~/videos-all.txt | ytlinks "$1"
}
function ytrecommend(){
cat ~/videos-all.txt | head -n -1000 > /tmp/ytbuff
cat ~/videos-all.txt | tail -n 1000 > /tmp/ytbufflast
history | grep -Poi '\d+ ytsearch "\K[a-z0-9-_ ]*' | sort | uniq | shuf -n 4 | while read -r t
do
q=`echo "$t" | sed 's/ /%20/g'`
curl "https://inv.nadeko.net/api/v1/search?q=$q%20sort:date" | jq -r '.[]|.videoId+","+.title'
done | tee -a /tmp/ytbufflast | ytlinks "$1"
cat /tmp/ytbufflast | awk '!seen[$x]++' >> /tmp/ytbuff
}
function ytparse(){
cat ~/Downloads/video_crawler_scrape/videos.csv | grep -Pao --color 'f,f,\K[a-zA-Z0-9-_]{11}.*' > ~/videos-all.txt
}
run these commands:
source .bashrc
ytparse