@@ -207,7 +207,6 @@ my %CONFIG = (
207207
208208 # URI options
209209 thumbnail_type => ' medium' ,
210- youtube_thumb_url => ' https://i1.ytimg.com/vi/%s/%s.jpg' ,
211210 youtube_video_url => ' https://www.youtube.com/watch?v=%s' ,
212211 youtube_playlist_url => ' https://www.youtube.com/playlist?list=%s' ,
213212 youtube_channel_url => ' https://www.youtube.com/channel/%s' ,
@@ -3350,6 +3349,8 @@ sub set_entry_details {
33503349 $linkbutton -> set_label($url );
33513350 $linkbutton -> set_uri($url );
33523351
3352+ my $info = $yv_obj -> parse_json_string($liststore -> get($iter , 8));
3353+
33533354 # Getting thumbs
33543355 foreach my $nr (qw( 1 2 3) ) {
33553356
@@ -3360,7 +3361,18 @@ sub set_entry_details {
33603361 my ($nr ) = @{$_ [0]};
33613362
33623363 if ($code =~ / $valid_video_id_re / ) {
3363- my $pixbuf = get_pixbuf_thumbnail(sprintf ($CONFIG {youtube_thumb_url }, $code , $nr ), 120, 90);
3364+
3365+ my $thumbnail = $info -> {snippet }{thumbnails }{default };
3366+ my $url = $thumbnail -> {url };
3367+
3368+ if ($url =~ / _live\.\w +\z / ) {
3369+ # # no extra thumbnails available while video is LIVE
3370+ }
3371+ else {
3372+ $url =~ s { /\w +\. (\w +)\z } { /$nr .$1 } ;
3373+ }
3374+
3375+ my $pixbuf = get_pixbuf_thumbnail($url , $thumbnail -> {width } // 120, $thumbnail -> {height } // 90);
33643376 $gui -> get_object(" image$nr " )-> set_from_pixbuf($pixbuf );
33653377 }
33663378 else {
0 commit comments