Ĉi tiu deponejo arĥiviĝis je 2024-01-29. Vi povas vidi kaj elŝuti dosierojn, sed ne povas puŝi nek raporti problemojn nek tirpeti.
shellTube/yt-desc

45 lines
808 B
Plaintext
Raw Normal View History

2019-01-23 20:44:29 -06:00
#!/bin/sh
2019-01-23 20:17:29 -06:00
##############################
# name: yt-desc
# lisc: gnu gplv3
# main: jadedctrl
# desc: print desc of yt video
##############################
# Usage: yt-desc "$url/id"
2019-01-23 20:44:29 -06:00
# STRING --> STRING
# Get the description of a YT video, from HTML.
function video_desc {
local html="$1"
echo "$html" \
| grep "action-panel-details" \
| sed 's/.*<p .*class="" >//' \
| sed 's%</p>.*%%' \
| lynx -stdin -dump \
| sed 's/^ //'
}
2019-01-23 20:17:29 -06:00
# --------------------------------------
# invocation
2019-01-23 20:44:29 -06:00
function usage {
echo "usage: yt-desc url/id"
2019-01-23 20:17:29 -06:00
exit 2
2019-01-23 20:44:29 -06:00
}
2019-01-23 20:17:29 -06:00
2019-01-23 20:44:29 -06:00
# --------------------------------------
2019-01-23 20:17:29 -06:00
2019-01-23 20:44:29 -06:00
if test -z "$1"; then
usage
elif echo "$1" | grep "youtube" > /dev/null; then
URL="$1"
else
URL="https://www.youtube.com/watch?v=${1}"
fi
2019-01-23 20:17:29 -06:00
# --------------------------------------
2019-01-23 20:44:29 -06:00
video_desc "$(gendl "$URL")"