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
1 changed files with 2 additions and 1 deletions

View File

@ -3,6 +3,7 @@
# Modifications: Alexander Epstein https://github.com/alexanderepstein
if [[ -d $HOME/.cache/ytview ]];then rm -rf $HOME/.cache/ytview/ ;fi
player=""
configuredClient=""
currentVersion="1.8.0"
@ -151,7 +152,7 @@ searchview()
mkdir -p $HOME/.cache/ytview/searches/$search
#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
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