From ffe6be54a398b5a0a778d9e1d7018cee6f0fa9e0 Mon Sep 17 00:00:00 2001 From: Theo Henson Date: Sat, 6 Jun 2020 02:14:36 -0400 Subject: [PATCH] Fix link generation The old method which channel IDs are obtained via username was unreliable. Occasionally it resulted in a big blob of json being put into your links file. This patch fixes that, using a different method of getting a channel ID from a username. --- subs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subs b/subs index db3a5f6..5cf8cc8 100755 --- a/subs +++ b/subs @@ -62,8 +62,8 @@ gen_links() { esac # otherwise we are given a username, we must find out its channel ID - curl -sfL --retry 10 "https://youtube.com/user/$line/about" | grep channel_id | \ - sed -e 's|www\.||' -e 's|.*href="||' -e 's|">.*||' >>"$SUBS_LINKS" + curl -sfL --retry 10 "https://youtube.com/user/$line/about" | \ + echo "https://youtube.com/feeds/videos.xml?channel_id=$(grep -ohm 1 'channel\/UC......................' | tail -c 25)" >>"$SUBS_LINKS" done <"$SUBS_FILE" }