Created
November 28, 2022 15:08
-
-
Save pradyumnac/c067a3e8c35de4fa2c0ee4bc463b4ff8 to your computer and use it in GitHub Desktop.
Convert Youtube subscriptions(CSV) from google take out to newsboat urls format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
LATEST_SUBSCRIPTIONS_FP=~/repos/exports/yt/subscriptions.csv | |
NEWSBOAT_YOUTUBE_FP=~/repos/newsboat/urlcategory/youtube | |
if test -f $NEWSBOAT_YOUTUBE_FP | |
then | |
cp $NEWSBOAT_YOUTUBE_FP $NEWSBOAT_YOUTUBE_FP.bk | |
rm $NEWSBOAT_YOUTUBE_FP | |
fi | |
if test -f $LATEST_SUBSCRIPTIONS_FP | |
then | |
while IFS="," read -r channel_id url name | |
do | |
CHID=$(echo $url| awk -F'/' '{print $5}') | |
echo "https://www.youtube.com/feeds/videos.xml?channel_id=$CHID \"~$name\" Youtube" >> $NEWSBOAT_YOUTUBE_FP | |
done < <(tail -n +2 $LATEST_SUBSCRIPTIONS_FP ) | |
echo "$LATEST_SUBSCRIPTIONS_FP ==> $NEWSBOAT_YOUTUBE_FP import successful" | |
else | |
echo "ERROR: Not found - $LATEST_SUBSCRIPTIONS_FP" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment