From 04b7a64c3844ae6a3db769f846fb1c166f8331bf Mon Sep 17 00:00:00 2001 From: Mitch Weaver Date: Sat, 6 Jun 2020 10:25:05 -0500 Subject: [PATCH] POSIX-ify latest commit --- subs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/subs b/subs index 5cf8cc8..e29e991 100755 --- a/subs +++ b/subs @@ -62,8 +62,17 @@ 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" | \ - echo "https://youtube.com/feeds/videos.xml?channel_id=$(grep -ohm 1 'channel\/UC......................' | tail -c 25)" >>"$SUBS_LINKS" + curl -sfL --retry 10 "https://youtube.com/user/$line/about" | \ + while read -r line ; do + case $line in + *channel/UC??????????????????????*) + line=${line##*channel/} + line=${line%%\"*} + printf 'https://youtube.com/feeds/videos.xml?channel_id=%s\n' \ + "$line" >>"$SUBS_LINKS" + break + esac + done done <"$SUBS_FILE" }