Guest User

audio-only hacked ver of jwz.org/hacks/youtubedown

a guest
Nov 20th, 2015
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 3.98 KB | None | 0 0
  1. --- youtubedown-20151118.pl 2015-11-18 16:14:11.785899942 -0500
  2. +++ youtubeaudio-20151118.pl    2015-11-18 16:27:18.357897536 -0500
  3. @@ -2636,7 +2636,7 @@
  4.      } @$S;
  5.    }
  6.  
  7. -  my $vfmt = undef;
  8. +#  my $vfmt = undef;
  9.    my $afmt = undef;
  10.    my $mfmt = undef;
  11.  
  12. @@ -2654,12 +2654,12 @@
  13.    # pre-muxed format.
  14.    #
  15.    if (defined($force_fmt) && $force_fmt eq 'mux') {
  16. -    foreach my $target (@pref_vo) {
  17. -      if ($fmts->{$target}) {
  18. -        $vfmt = $target;
  19. -        last;
  20. -      }
  21. -    }
  22. +#    foreach my $target (@pref_vo) {
  23. +#      if ($fmts->{$target}) {
  24. +#        $vfmt = $target;
  25. +#        last;
  26. +#      }
  27. +#    }
  28.      foreach my $target (@pref_ao) {
  29.        if ($fmts->{$target}) {
  30.          $afmt = $target;
  31. @@ -2670,40 +2670,40 @@
  32.      # If we got one of the formats and not the other, this isn't going to
  33.      # work. Fall back on pre-muxed.
  34.      #
  35. -    if (($vfmt || $afmt) && !($vfmt && $afmt)) {
  36. -      print STDERR "$progname: $id: found " .
  37. -                   ($vfmt ? 'video-only' : 'audio-only') . ' but no ' .
  38. -                   ($afmt ? 'video-only' : 'audio-only') . " formats.\n"
  39. -        if ($verbose > 1);
  40. -      $vfmt = undef;
  41. -      $afmt = undef;
  42. -    }
  43. + #   if (($vfmt || $afmt) && !($vfmt && $afmt)) {
  44. + #     print STDERR "$progname: $id: found " .
  45. + #                  ($vfmt ? 'video-only' : 'audio-only') . ' but no ' .
  46. + #                  ($afmt ? 'video-only' : 'audio-only') . " formats.\n"
  47. + #       if ($verbose > 1);
  48. + #     $vfmt = undef;
  49. + #     $afmt = undef;
  50. + #   }
  51.  
  52.      # If the best unmuxed format is not better resolution than the best
  53.      # pre-muxed format, just use the pre-muxed version.
  54.      #
  55. -    if ($mfmt &&
  56. -        $vfmt &&
  57. -        $known_formats{$vfmt}->{h} <= $known_formats{$mfmt}->{h}) {
  58. -      print STDERR "$progname: $id: rejecting $vfmt + $afmt (" .
  59. -                   $known_formats{$vfmt}->{w} . " x " .
  60. -                   $known_formats{$vfmt}->{h} . ") for $mfmt (" .
  61. -                   $known_formats{$mfmt}->{w} . " x " .
  62. -                   $known_formats{$mfmt}->{h} . ")\n"
  63. -        if ($verbose > 1);
  64. -      $vfmt = undef;
  65. -      $afmt = undef;
  66. -    }
  67. + #   if ($mfmt &&
  68. + #       $vfmt &&
  69. + #       $known_formats{$vfmt}->{h} <= $known_formats{$mfmt}->{h}) {
  70. + #     print STDERR "$progname: $id: rejecting $vfmt + $afmt (" .
  71. + #                  $known_formats{$vfmt}->{w} . " x " .
  72. + #                  $known_formats{$vfmt}->{h} . ") for $mfmt (" .
  73. + #                  $known_formats{$mfmt}->{w} . " x " .
  74. + #                  $known_formats{$mfmt}->{h} . ")\n"
  75. + #       if ($verbose > 1);
  76. + #     $vfmt = undef;
  77. + #     $afmt = undef;
  78. + #   }
  79.  
  80.  
  81.      # At this point, we're definitely intending to mux.
  82.      # But maybe we can't because there's no ffmpeg -- if so, print
  83.      # a warning, then fall back to a lower resolution stream.
  84.      #
  85. -    if ($vfmt && $afmt && !which ("ffmpeg")) {
  86. +    if ($afmt && !which ("ffmpeg")) {
  87.        print STDERR "$progname: WARNING: $id: \"ffmpeg\" not installed.\n";
  88.        print STDERR "$progname:          $id: downloading lower resolution.\n";
  89. -      $vfmt = undef;
  90. +#      $vfmt = undef;
  91.        $afmt = undef;
  92.      }
  93.    }
  94. @@ -2734,14 +2734,14 @@
  95.      }
  96.    }
  97.  
  98. -  if ($vfmt && $afmt) {
  99. +  if ($afmt) {
  100.      if ($verbose > 1) {
  101. -      my $d1 = $known_formats{$vfmt}->{desc};
  102. +#      my $d1 = $known_formats{$vfmt}->{desc};
  103.        my $d2 = $known_formats{$afmt}->{desc};
  104. -      foreach ($d1, $d2) { s@ [av]/?o$@@si; }
  105. -      print STDERR "$progname: $id: picked $vfmt + $afmt ($d1 + $d2)\n";
  106. +      foreach ($d2) { s@ [av]/?o$@@si; }
  107. +      print STDERR "$progname: $id: picked $afmt ($d2)\n";
  108.      }
  109. -    return ($vfmt, $afmt);
  110. +    return ($afmt);
  111.    } else {
  112.      # Either not muxing, or muxing not available/necessary.
  113.      my $why = 'picked';
  114. @@ -3376,6 +3376,7 @@
  115.  # the two originals.
  116.  #
  117.  sub mux_downloaded_files($$$$$$) {
  118. +return;
  119.    my ($id, $url, $title, $v1, $v2, $muxed_file) = @_;
  120.  
  121.    my $video_file = $v1->{file};
Add Comment
Please, Sign In to add comment