Update avatar and channel name on video refresh

This commit is contained in:
John Mertz 2024-11-06 11:04:35 -07:00
parent 7efe91e67a
commit a9657b6fe2
Signed by: jpm
GPG Key ID: E9C5EA2D867501AB
1 changed files with 6 additions and 2 deletions

View File

@ -2,9 +2,8 @@ package YTYT;
use strict; use strict;
use warnings; use warnings;
use Data::Dump;
use utf8; use utf8;
use DBI; use DBI;
use JSON::Any; use JSON::Any;
use WWW::Mechanize; use WWW::Mechanize;
@ -94,6 +93,11 @@ sub latest_videos {
my $content = get_videos_page($self, %params); 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}->{sectionListRenderer}->{contents}->[0]->{itemSectionRenderer}->{contents}->[0]->{gridRenderer}->{items};
my $list_ref = $content->{contents}->{twoColumnBrowseResultsRenderer}->{tabs}->[1]->{tabRenderer}->{content}->{richGridRenderer}->{contents}; my $list_ref = $content->{contents}->{twoColumnBrowseResultsRenderer}->{tabs}->[1]->{tabRenderer}->{content}->{richGridRenderer}->{contents};
my ($offset, $last) = (0, 0); my ($offset, $last) = (0, 0);