Skip to content

Commit

Permalink
Recognize HDR itags.
Browse files Browse the repository at this point in the history
  • Loading branch information
trizen committed Jun 27, 2022
1 parent 27957f4 commit f36bbf1
Showing 1 changed file with 27 additions and 11 deletions.
38 changes: 27 additions & 11 deletions lib/WWW/YoutubeViewer/Itags.pm
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ sub get_itags {
{value => 399, format => 'av1', dash => 1, hfr => 1}, # av1 (v)
{value => 46, format => 'webm'}, # webm (v-a)
{value => 37, format => 'mp4'}, # mp4 (v-a)
{value => 301, format => 'mp4', live => 1}, # mp4 (live) (v-a)
{value => 96, format => 'ts', live => 1}, # ts (live) (v-a)
{value => 301, format => 'mp4', live => 1}, # mp4 (live) (v-a)
{value => 96, format => 'ts', live => 1}, # ts (live) (v-a)
{value => 335, format => 'webm', dash => 1, hdr => 1}, # vp9 HDR (v)
{value => 699, format => 'av1', dash => 1, hdr => 1}, # av1 HDR (v)
],

'720' => [{value => 302, format => 'webm', dash => 1, hfr => 1}, # webm HFR (v)
Expand All @@ -77,17 +79,21 @@ sub get_itags {
{value => 398, format => 'av1', dash => 1, hfr => 1}, # av1 (v)
{value => 45, format => 'webm'}, # webm (v-a)
{value => 22, format => 'mp4'}, # mp4 (v-a)
{value => 300, format => 'mp4', live => 1}, # mp4 (live) (v-a)
{value => 120, format => 'flv', live => 1}, # flv (live) (v-a)
{value => 95, format => 'ts', live => 1}, # ts (live) (v-a)
{value => 300, format => 'mp4', live => 1}, # mp4 (live) (v-a)
{value => 120, format => 'flv', live => 1}, # flv (live) (v-a)
{value => 95, format => 'ts', live => 1}, # ts (live) (v-a)
{value => 334, format => 'webm', dash => 1, hdr => 1}, # vp9 HDR (v)
{value => 698, format => 'av1', dash => 1, hdr => 1}, # av1 HDR (v)
],

'480' => [{value => 244, format => 'webm', dash => 1}, # webm (v)
{value => 135, format => 'mp4', dash => 1}, # mp4 (v)
{value => 397, format => 'av1', dash => 1}, # av1 (v)
{value => 44, format => 'webm'}, # webm (v-a)
{value => 35, format => 'flv'}, # flv (v-a)
{value => 94, format => 'mp4', live => 1}, # mp4 (live) (v-a)
{value => 94, format => 'mp4', live => 1}, # mp4 (live) (v-a)
{value => 333, format => 'webm', dash => 1, hdr => 1}, # vp9 HDR (v)
{value => 697, format => 'av1', dash => 1, hdr => 1}, # av1 HDR (v)
],

'360' => [{value => 243, format => 'webm', dash => 1}, # webm (v)
Expand All @@ -97,6 +103,8 @@ sub get_itags {
{value => 34, format => 'flv'}, # flv (v-a)
{value => 93, format => 'mp4', live => 1}, # mp4 (live) (v-a)
{value => 18, format => 'mp4'}, # mp4 (v-a)
{value => 332, format => 'webm', dash => 1, hdr => 1}, # vp9 HDR (v)
{value => 696, format => 'av1', dash => 1, hdr => 1}, # av1 HDR (v)
],

'240' => [{value => 242, format => 'webm', dash => 1}, # webm (v)
Expand All @@ -106,8 +114,10 @@ sub get_itags {
{value => 5, format => 'flv'}, # flv (v-a)
{value => 36, format => '3gp'}, # 3gp (v-a)
{value => 13, format => '3gp'}, # 3gp (v-a)
{value => 92, format => 'mp4', live => 1}, # mp4 (live) (v-a)
{value => 132, format => 'ts', live => 1}, # ts (live) (v-a)
{value => 92, format => 'mp4', live => 1}, # mp4 (live) (v-a)
{value => 132, format => 'ts', live => 1}, # ts (live) (v-a)
{value => 331, format => 'webm', dash => 1, hdr => 1}, # vp9 HDR (v)
{value => 695, format => 'av1', dash => 1, hdr => 1}, # av1 HDR (v)
],

'144' => [{value => 278, format => 'webm', dash => 1}, # webm (v)
Expand All @@ -116,6 +126,8 @@ sub get_itags {
{value => 17, format => '3gp'}, # 3gp (v-a)
{value => 91, format => 'mp4'}, # mp4 (live) (v-a)
{value => 151, format => 'ts'}, # ts (live) (v-a)
{value => 330, format => 'webm', dash => 1, hdr => 1}, # vp9 HDR (v)
{value => 694, format => 'av1', dash => 1, hdr => 1}, # av1 HDR (v)
],

'audio' => [{value => 172, format => 'webm', kbps => 192}, # webm (192 kbps)
Expand Down Expand Up @@ -223,8 +235,12 @@ Return the streaming URL which corresponds with the specified resolution.
(
urls => \@streaming_urls,
resolution => 'resolution_name', # from $obj->get_resolutions(),
dash => 1/0, # include or exclude DASH itags
dash_segmented => 1/0, # include or exclude segmented DASH videos
hfr => 1/0, # include or exclude High Frame Rate videos
ignore_av1 => 1/0, # true to ignore videos in AV1 format
dash => 1/0, # include or exclude split videos
m4a_audio => 1/0, # incldue or exclude M4A audio files
dash_segmented => 1/0, # include or exclude streams in DASH format
)
=cut
Expand All @@ -249,7 +265,7 @@ sub find_streaming_url {
}

# Check if we do recognize all the audio/video formats
foreach my $stream_itag (keys %stream) {
foreach my $stream_itag (sort keys %stream) {

next if $stream_itag =~ m{^(?:sb[012])\z};

Expand Down

0 comments on commit f36bbf1

Please sign in to comment.