Proposing multiple changes #2
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
|
|
||||||
interactive_mode=0
|
interactive_mode=0
|
||||||
channel_file="/tmp/$(mktemp -u yt-channel_XXXXX)"
|
channel_file="/tmp/$(mktemp -u yt-channel_XXXXXX)"
|
||||||
|
|
||||||
# I really need to work out a better way to take flags.
|
# I really need to work out a better way to take flags.
|
||||||
# This is just awful.
|
# This is just awful.
|
||||||
|
@ -82,7 +82,7 @@ function get_input() {
|
||||||
row=0
|
row=0
|
||||||
|
|
||||||
# Now for displaying the search results
|
# Now for displaying the search results
|
||||||
temp_file="/tmp/$(mktemp -u yt-channel_XXXXX)"
|
temp_file="/tmp/$(mktemp -u yt-channel_XXXXXX)"
|
||||||
|
|
||||||
grep "href=\"\/watch?v=" $channel_file | grep "title=" | grep -v \
|
grep "href=\"\/watch?v=" $channel_file | grep "title=" | grep -v \
|
||||||
"<span class=\"yt-thumb-simple\"" > $temp_file
|
"<span class=\"yt-thumb-simple\"" > $temp_file
|
||||||
|
|
|
@ -21,7 +21,7 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
video_file="/tmp/$(mktemp -u yt-video_XXXXX)"
|
video_file="/tmp/$(mktemp -u yt-video_XXXXXX)"
|
||||||
if type "wget" &> /dev/null
|
if type "wget" &> /dev/null
|
||||||
then
|
then
|
||||||
wget -q https://youtube.com/watch?v=$id -O $video_file
|
wget -q https://youtube.com/watch?v=$id -O $video_file
|
||||||
|
|
|
@ -55,12 +55,12 @@ function get_input() {
|
||||||
# layout, this script'll break immediately, haha.
|
# layout, this script'll break immediately, haha.
|
||||||
# ... But at least we aren't using their API, right?
|
# ... But at least we aren't using their API, right?
|
||||||
|
|
||||||
search_file="/tmp/$(mktemp -u yt-search_XXXXX)"
|
search_file="/tmp/$(mktemp -u yt-search_XXXXXX)"
|
||||||
|
|
||||||
st-download https://youtube.com/results?search_query=$query $search_file
|
st-download https://youtube.com/results?search_query=$query $search_file
|
||||||
|
|
||||||
# Now for displaying the search results
|
# Now for displaying the search results
|
||||||
temp_file="/tmp/$(mktemp -u yt-result_XXXXX)"
|
temp_file="/tmp/$(mktemp -u yt-result_XXXXXX)"
|
||||||
grep "<a href=\"\/watch?v=" $search_file | grep -v "<span class=\"yt-thumb-simple\"" > $temp_file
|
grep "<a href=\"\/watch?v=" $search_file | grep -v "<span class=\"yt-thumb-simple\"" > $temp_file
|
||||||
item_num=0
|
item_num=0
|
||||||
cat $temp_file | while IFS='' read -r CUR_LINE
|
cat $temp_file | while IFS='' read -r CUR_LINE
|
||||||
|
|
|
@ -22,14 +22,14 @@
|
||||||
# [ ] Cli args as commands
|
# [ ] Cli args as commands
|
||||||
|
|
||||||
search() {
|
search() {
|
||||||
output="$(mktemp /tmp/yt-XXXXXX)"
|
output="$(mktemp -u /tmp/yt_XXXXXX)"
|
||||||
yt-search -i "$1" "$output"
|
yt-search -i "$1" "$output"
|
||||||
selected_video="$(cat "$output")"
|
selected_video="$(cat "$output")"
|
||||||
yt-meta "$selected_video"
|
yt-meta "$selected_video"
|
||||||
}
|
}
|
||||||
|
|
||||||
channel() {
|
channel() {
|
||||||
output="$(mktemp -u /tmp/yt-channel-XXXXXXX)"
|
output="$(mktemp -u /tmp/yt-channel_XXXXXX)"
|
||||||
case "$1" in
|
case "$1" in
|
||||||
UC* )
|
UC* )
|
||||||
yt-channel -ic "$1" "$output"
|
yt-channel -ic "$1" "$output"
|
||||||
|
|
Reference in New Issue