#!/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 .
# Copyright (c) 2022, Miquel Lionel
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 \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