Browse code

Added yt-desc

Jaidyn Lev authored on 2019-01-24 02:17:29
Showing 2 changed files
... ...
@@ -6,7 +6,7 @@ browse YouTube quickly, and entirely without captive UIs.
6 6
 Right now, there's only one script, yt-search
7 7
 
8 8
 shelltube is written in pure shell; its only dependencies
9
-are any modern shell (pdksh, bash, zsh) and curl/wget/ftp.
9
+are any modern shell (pdksh, bash, zsh), lynx, and curl/wget/ftp.
10 10
 Your terminal should accept ANSI color-codes, too~
11 11
 
12 12
 Before, shelltube was a set of scripts that culimated in a wrapper
... ...
@@ -22,9 +22,9 @@ ye spectre of ole!), and starting from scratch. :)
22 22
 ----------------------------------------
23 23
 USAGE
24 24
 ----------------------------------------
25
-There is one script that makes up shelltube:
26
-	* yt-search
27 25
 
26
+YT-SEARCH
27
+--------------------
28 28
 yt-search lists videos matching a certain search query.
29 29
 	USAGE: yt-search [-csmb] query
30 30
 
... ...
@@ -38,10 +38,19 @@ Big takes up two lines, while the rest only use one.
38 38
 If you're piping output, you might wanna usa -m, -s, or -c.
39 39
 
40 40
 
41
+YT-DESC
42
+--------------------
43
+yt-desc prints the description of a YT video.
44
+	USAGE: yt-desc url/id
41 45
 
46
+The only argument it takes is the URL/ID of the video.
47
+This script requires `lynx`.
48
+
49
+
50
+GENDL
51
+--------------------
42 52
 There is another script that comes with shelltube (which it uses
43
-extensively:
44
-	* gendl
53
+extensively: gendl.
45 54
 
46 55
 gendl can download files on a system that has at least one of these:
47 56
 	* ftp
... ...
@@ -50,7 +59,7 @@ gendl can download files on a system that has at least one of these:
50 59
 
51 60
 ... to stdout or to a file.
52 61
 
53
-yt-search uses gendl--
62
+yt-search and yt-desc use gendl--
54 63
 so make sure they're both in the same directory (or, at least, that
55 64
 gendl is in your $PATH)
56 65
 
57 66
new file mode 100755
... ...
@@ -0,0 +1,39 @@
1
+##############################
2
+# name: yt-desc
3
+# lisc: gnu gplv3
4
+# main: jadedctrl
5
+# desc: print desc of yt video
6
+##############################
7
+
8
+# Usage: yt-desc "$url/id"
9
+
10
+# --------------------------------------
11
+# invocation
12
+
13
+USAGE="usage: yt-desc url/id"
14
+
15
+if test -z "$1"
16
+then
17
+	echo "$USAGE"
18
+	exit 2
19
+fi
20
+
21
+if test -n "$1"; then
22
+	if echo "$1" | grep "youtube"; then
23
+		URL="$1"
24
+	else
25
+		URL="https://www.youtube.com/watch?v=${1}"
26
+	fi
27
+fi
28
+
29
+
30
+
31
+# --------------------------------------
32
+# invocation <3
33
+
34
+gendl "$URL" \
35
+| grep "action-panel-details" \
36
+| sed 's/.*<p .*class="" >//' \
37
+| sed 's%</p>.*%%' \
38
+| lynx -stdin -dump \
39
+| sed 's/^   //'