blob: cde32fa34a6fbd9d271e9d06cae8edd06a2c4448 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#!/bin/bash
#
# 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`"
# 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"
|