From e3dc3578a46ec6a4f64919057f9a92c084f4df0e Mon Sep 17 00:00:00 2001 From: John Mertz Date: Wed, 22 Mar 2023 18:14:55 -0400 Subject: [PATCH] Add 'handle' support for new subscriptions These are not logged in the database, but will be added to the new version --- bin/add_youtube_subscription.pl | 2 +- lib/YTYT.pm | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/bin/add_youtube_subscription.pl b/bin/add_youtube_subscription.pl index bc5c9e7..51a15a4 100755 --- a/bin/add_youtube_subscription.pl +++ b/bin/add_youtube_subscription.pl @@ -27,7 +27,7 @@ if ($ARGV[0] =~ m%^UC[a-zA-Z0-9\-\_]{22}$%) { #print "Found raw channelId " . $params{channelId} . "\n"; } elsif ($ARGV[0] =~ m%^(?:(?:https://)?(?:www\.|m\.)?youtube\.com/)?\@([^\/]+)%) { $params{channelHandle} = $1; - die("Handles are not yet supported. Found \@$params{channelHandle}\n"); + #die("Handles are not yet supported. Found \@$params{channelHandle}\n"); } elsif ($ARGV[0] =~ m%^(https://)?(www\.|m\.)?youtube\.com/channel/UC[a-zA-Z0-9\-\_]{22}%) { $params{channelId} = $ARGV[0]; $params{channelId} =~ s%(https://)?(www\.|m\.)?youtube\.com/channel/(UC[^/]{22})(/.*)?%$3%; diff --git a/lib/YTYT.pm b/lib/YTYT.pm index 6333658..7194610 100644 --- a/lib/YTYT.pm +++ b/lib/YTYT.pm @@ -52,6 +52,11 @@ sub get_videos_page { $get = $self->{location} . '/' . 'channel/' . $params{channelId} . '/videos'; + } elsif (defined $params{channelHandle}) { + $target = $params{channelHandle}; + $get = $self->{location} . '/' . + '@' . $params{channelHandle} . + '/videos'; } elsif (defined $params{channelName}) { $target = $params{channelName}; $get = $self->{location} . '/' .