From a9657b6fe2861244bb16fa4b2bbaf5d97d168be9 Mon Sep 17 00:00:00 2001 From: John Mertz Date: Wed, 6 Nov 2024 11:04:35 -0700 Subject: [PATCH] Update avatar and channel name on video refresh --- lib/YTYT.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/YTYT.pm b/lib/YTYT.pm index 7194610..1ac381a 100644 --- a/lib/YTYT.pm +++ b/lib/YTYT.pm @@ -2,9 +2,8 @@ package YTYT; use strict; use warnings; - -use Data::Dump; use utf8; + use DBI; use JSON::Any; use WWW::Mechanize; @@ -94,6 +93,11 @@ sub latest_videos { my $content = get_videos_page($self, %params); + $params{table} = 'channels'; + $params{channelName} = $content->{metadata}->{channelMetadataRenderer}->{title}; + $params{channelThumbnail} = $content->{metadata}->{channelMetadataRenderer}->{avatar}->{thumbnails}->[0]->{url}; + $self->db_update(%params); + #my $list_ref = $content->{contents}->{twoColumnBrowseResultsRenderer}->{tabs}->[1]->{tabRenderer}->{content}->{sectionListRenderer}->{contents}->[0]->{itemSectionRenderer}->{contents}->[0]->{gridRenderer}->{items}; my $list_ref = $content->{contents}->{twoColumnBrowseResultsRenderer}->{tabs}->[1]->{tabRenderer}->{content}->{richGridRenderer}->{contents}; my ($offset, $last) = (0, 0);