aboutsummaryrefslogtreecommitdiff
path: root/urlinfo
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2021-02-19 16:05:56 -0300
committerSilvio Rhatto <rhatto@riseup.net>2021-02-19 16:05:56 -0300
commit835d41f2cd5eafbbd5ff92eae66b1a0d91c5547b (patch)
treecef7bb01004aed29728977cb928f0789491d54be /urlinfo
parentfd636e5779ff348a7b06cbdf5c36a3849f1e4d3b (diff)
downloadscripts-835d41f2cd5eafbbd5ff92eae66b1a0d91c5547b.tar.gz
scripts-835d41f2cd5eafbbd5ff92eae66b1a0d91c5547b.tar.bz2
Feats: enhance urlinfo and creates urlsave
Diffstat (limited to 'urlinfo')
-rwxr-xr-xurlinfo31
1 files changed, 29 insertions, 2 deletions
diff --git a/urlinfo b/urlinfo
index 7a4cd49..cde32fa 100755
--- a/urlinfo
+++ b/urlinfo
@@ -1,12 +1,39 @@
#!/bin/bash
#
-# Retrieve basic URL info.
+# Retrieve and set basic URL info.
#
# Parameters
BASENAME="`basename $0`"
URL="$1"
+shift
+TAGS="$*"
+
+# Check
+if [ -z "$URL" ]; then
+ echo "usage: $BASENAME <url> [tag1] ... [tagN]"
+ exit 1
+fi
# Dispatch
DESC="`torify curl --max-redirs 10 -L -s $URL | grep -i "<title>" | sed -n 's/.*<title>\(.*\)<\/title>.*/\1/ip;T;q' 2> /dev/null`"
-echo "Title: $DESC"
+
+# YouTube:
+#DESC="`torify curl youtube-dl -e $URL`"
+
+# Verify
+if [ -z "$DESC" ]; then
+ DESC="$URL"
+fi
+
+# Tag
+if [ ! -z "$TAGS" ]; then
+ IDENTIFIER="$URL $TAGS"
+else
+ IDENTIFIER="$URL"
+fi
+
+# Display
+echo "- title: \"$DESC\""
+echo " identifier:"
+echo " - $IDENTIFIER"