Added yt-desc

This commit is contained in:
Jaidyn Lev 2019-01-23 20:17:29 -06:00
parent 1d1e60827e
commit 80df9f5f69
2 changed files with 54 additions and 6 deletions

View File

@ -6,7 +6,7 @@ browse YouTube quickly, and entirely without captive UIs.
Right now, there's only one script, yt-search Right now, there's only one script, yt-search
shelltube is written in pure shell; its only dependencies shelltube is written in pure shell; its only dependencies
are any modern shell (pdksh, bash, zsh) and curl/wget/ftp. are any modern shell (pdksh, bash, zsh), lynx, and curl/wget/ftp.
Your terminal should accept ANSI color-codes, too~ Your terminal should accept ANSI color-codes, too~
Before, shelltube was a set of scripts that culimated in a wrapper Before, shelltube was a set of scripts that culimated in a wrapper
@ -22,9 +22,9 @@ ye spectre of ole!), and starting from scratch. :)
---------------------------------------- ----------------------------------------
USAGE USAGE
---------------------------------------- ----------------------------------------
There is one script that makes up shelltube:
* yt-search
YT-SEARCH
--------------------
yt-search lists videos matching a certain search query. yt-search lists videos matching a certain search query.
USAGE: yt-search [-csmb] query USAGE: yt-search [-csmb] query
@ -38,10 +38,19 @@ Big takes up two lines, while the rest only use one.
If you're piping output, you might wanna usa -m, -s, or -c. If you're piping output, you might wanna usa -m, -s, or -c.
YT-DESC
--------------------
yt-desc prints the description of a YT video.
USAGE: yt-desc url/id
The only argument it takes is the URL/ID of the video.
This script requires `lynx`.
GENDL
--------------------
There is another script that comes with shelltube (which it uses There is another script that comes with shelltube (which it uses
extensively: extensively: gendl.
* gendl
gendl can download files on a system that has at least one of these: gendl can download files on a system that has at least one of these:
* ftp * ftp
@ -50,7 +59,7 @@ gendl can download files on a system that has at least one of these:
... to stdout or to a file. ... to stdout or to a file.
yt-search uses gendl-- yt-search and yt-desc use gendl--
so make sure they're both in the same directory (or, at least, that so make sure they're both in the same directory (or, at least, that
gendl is in your $PATH) gendl is in your $PATH)

39
yt-desc Executable file
View File

@ -0,0 +1,39 @@
##############################
# name: yt-desc
# lisc: gnu gplv3
# main: jadedctrl
# desc: print desc of yt video
##############################
# Usage: yt-desc "$url/id"
# --------------------------------------
# invocation
USAGE="usage: yt-desc url/id"
if test -z "$1"
then
echo "$USAGE"
exit 2
fi
if test -n "$1"; then
if echo "$1" | grep "youtube"; then
URL="$1"
else
URL="https://www.youtube.com/watch?v=${1}"
fi
fi
# --------------------------------------
# invocation <3
gendl "$URL" \
| grep "action-panel-details" \
| sed 's/.*<p .*class="" >//' \
| sed 's%</p>.*%%' \
| lynx -stdin -dump \
| sed 's/^ //'