2
0
Fork 0
mirror of https://github.com/alexanderepstein/Bash-Snippets synced 2018-11-08 02:59:35 +01:00

ytview bug fix (#33)

* Fixed ytview bug

* Cleaned up some code
This commit is contained in:
Linyos Torovoltos 2017-07-04 08:47:27 -04:00 committed by Alex Epstein
parent 230936e760
commit d9fed02bbf

View file

@ -3,6 +3,7 @@
# Modifications: Alexander Epstein https://github.com/alexanderepstein # Modifications: Alexander Epstein https://github.com/alexanderepstein
if [[ -d $HOME/.cache/ytview ]];then rm -rf $HOME/.cache/ytview/ ;fi if [[ -d $HOME/.cache/ytview ]];then rm -rf $HOME/.cache/ytview/ ;fi
player="" player=""
configuredClient="" configuredClient=""
currentVersion="1.8.0" currentVersion="1.8.0"
@ -151,7 +152,7 @@ searchview()
mkdir -p $HOME/.cache/ytview/searches/$search mkdir -p $HOME/.cache/ytview/searches/$search
#Get video titles #Get video titles
httpGet https://www.youtube.com/results\?search_query\=$search | grep "Duration" | awk '{print $13 " " $14 " " $15 " " $16 " " $17 " " $18 " " $19 " " $20 " " $21 " " $22 " " $23 " " $24 " " $25 " " $26 " " $27 " " $29}' | sed 's/aria-describedby="description-id.*//' | sed s/title=// | sed 's/"//' | sed 's/"//' | sed s/spf-link// | sed 's/data-sessionlink=itct*.//' | sed s/spf-prefetch// | tail -n 17 | sed 's/rel="//' | sed 's/"//' | awk '{printf "%s.\t%s\n",NR,$0}' > $HOME/.cache/ytview/searches/$search/titles.txt || return 1 httpGet https://www.youtube.com/results\?search_query\=$search | grep "Duration" | grep "watch?v="| awk '{print $13 " " $14 " " $15 " " $16 " " $17 " " $18 " " $19 " " $20 " " $21 " " $22 " " $23 " " $24 " " $25 " " $26 " " $27 " " $29}' | sed 's/aria-describedby="description-id.*//' | sed s/title=// | sed 's/"//' | sed 's/"//' | sed s/spf-link// | sed 's/data-sessionlink=itct*.//' | sed s/spf-prefetch// | tail -n 17 | sed 's/rel="//' | sed 's/"//' | awk '{printf "%s.\t%s\n",NR,$0}' > $HOME/.cache/ytview/searches/$search/titles.txt || return 1
#Get video urls #Get video urls
httpGet https://www.youtube.com/results\?search_query\=$search | grep "watch?v=" | awk '{print $5}' | sed s/vve-check// | sed 's/href="/https:\/\/www.youtube.com/' | sed 's/"//' | sed s/class="yt-uix-tile-link"// |sed '/^\s*$/d' | awk '{printf "%s.\t%s\n",NR,$0}' > $HOME/.cache/ytview/searches/$search/urls.txt || return 1 httpGet https://www.youtube.com/results\?search_query\=$search | grep "watch?v=" | awk '{print $5}' | sed s/vve-check// | sed 's/href="/https:\/\/www.youtube.com/' | sed 's/"//' | sed s/class="yt-uix-tile-link"// |sed '/^\s*$/d' | awk '{printf "%s.\t%s\n",NR,$0}' > $HOME/.cache/ytview/searches/$search/urls.txt || return 1