aboutsummaryrefslogtreecommitdiff
path: root/ytagslurp
blob: b534f000f7769e2a9cf3bdb90d21aa6a0b071535 (plain) (blame)
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
#!/bin/sh
# ytagslurp: extract tags from a youtube video

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.

# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

# Copyright (c) 2022, Miquel Lionel <lionel@les-miquelots.net>

INVIDIOUS_INSTANCE=yewtu.be
URL="$1"
DOMAIN="$(echo $URL | cut -d/ -f3)"

if [ -z "$URL" ]; then
    echo No URL provided
    printf "Copyright (c) 2022, Miquel Lionel <lionel@les-miquelots.net>\n"
    printf "\nytagslurp is a quite simple script to extract tags from a youtube video\n"
    printf "usage: ytagslurp [youtube URL]\n"
    exit 1
fi

SWAPPED_URL=$(echo $URL | sed "s/$DOMAIN/$INVIDIOUS_INSTANCE/g")
curl -s $SWAPPED_URL | grep "meta name=\"keywords\"" | cut -d\" -f4