summaryrefslogtreecommitdiffstats
path: root/.local/bin/youtube-id-rss
blob: abaab7b6c8b2213a647b398fcae5974c54b19573 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/bash

if [ "$#" -eq 0 ]
then
	echo "No URI argument supplied, using clipboard"
	uri="$(wl-paste)"
else
	uri="$1"
fi

uri_id=$(curl --silent "$uri" | tr "\"" "\n" | grep "^https" | uniq -c | sort -rn | awk 'NR==1{print $2}' )
base_id="$(echo "$uri_id" | awk -F "/" '{print $5}')"

printf "https://www.youtube.com/feeds/videos.xml?channel_id=%s\\n" "$base_id"