commit 322ebd8080a09e6918c9136020fb56be37a40530 parent 5ed3981a63f1dcb187a7dcedbca417f7a5308819 Author: Anders Damsgaard <anders@adamsgaard.dk> Date: Fri, 25 Jan 2019 12:49:56 +0100 Add script to fetch youtube channel id from url Diffstat:
A | links/bin/youtube-channel-id.sh | | | 16 | ++++++++++++++++ |
1 file changed, 16 insertions(+), 0 deletions(-)
diff --git a/links/bin/youtube-channel-id.sh b/links/bin/youtube-channel-id.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +function help { + echo "Usage: ${0##*/} <youtube-url>" +} + +[ $# -ne 1 ] && help && exit 1 + +id="$(curl --silent "$1" | \ + grep 'data-channel-external-id' | \ + sed 's/.*data-channel-external-id="//' | \ + sed 's/".*//' | \ + sed '1q')" + +echo "$id" +echo "$id" | xclip