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);