YouTube Links

Download YouTube videos. Supports 60fps video and 256kbps MP4 audio! Tag every video link so that they can be downloaded easily. Show the video formats at the top of the watch page.

As of 2016-06-27. See the latest version.

Author
nhyone
Ratings
0 0 0
Version
1.93
Created
2014-10-07
Updated
2016-06-27
License
N/A
Applies to

Tag every video link on a YouTube page so that they can be downloaded easily, using the title as the filename. Show the video formats at the top of the watch page.


The video links on the page are scanned in batches to avoid overloading the network. This works out nicely because YouTube has a request flood detector.

On DASH videos (Adaptive Video Streaming)

YouTube now uses adaptive video streaming for 480p and 1080p videos (Oct 2013). What this means is that the video and audio streams are now separate.

They are indicated as M4V and M4A. They have to be downloaded separately and mux'ed before playing. If using ffmpeg:

ffmpeg -i vid.m4v -i vid.m4a -vcodec copy -acodec copy vid.mp4

The filename is always videoplayback. Before saving, select and copy the page title first. Then right-click on the video link, save-as and paste the title. Set the extension to either m4v or m4a to distinguish between video and audio.

On VEVO videos

When a VEVO video is first accessed, the video links will not be shown because the de-obfuscated code is gotten too late. You need to manually refresh to see the links. This should happen just once — until YouTube changes the de-obfuscated code again.

If the video links are still not shown, it could be because the new de-obfuscated code is not recognized anymore. This happens once every few months; it is a cat-and-mouse game. Post in the forum so that I know about it. :-D

On 60fps videos

YouTube now supports 60fps (Oct 2014). The 720p/1080p DASH videos have itag 298/299 instead of 136/137. They can be downloaded as usual. However, I have added HFR (High Frame Rate) to make it more obvious.

On 256kbps MP4 audio

256kbps MP4 audio can now be downloaded! The link is only added for the watch page because it requires an additional HTTP request.

Note that just because a file is encoded in 256kbps does not mean it is really 256kbps. Check its spectrogram.

ffmpeg -i video.mp4 -vn audio.wav
sox audio.wav -n spectrogram

A real 256kbps audio file is not cut-off at 16kHz (128kbps) or 18kHz (192kbps). Some 192kbps audio are upscaled too.

Settings

There are some high-level settings in the script. Search for var userConfig = {.

var userConfig = {
  filteredFormats: [],
  showVideoFormats: true,
  showVideoSize: true,
  tagLinks: true
  };

filteredFormats: filter out listed formats.

Possible values: 3GP, FLV, M4A, M4V, MP4, WEBM

Default: none

To filter out WEBM videos, set it to [ "WEBM" ].

showVideoFormats: show the video formats at the top of the watch page.

Possible values: true / false / "btn"

Default: true

Set to false if you do not want the video formats.

The value "btn" (with the quotes) will show a VidFmts button at the top of the page. Click on the button to show the video formats.

showVideoSize: show video size.

Possible values: true / false

Default: true

Set to false if you do not want the video size. It will reduce network traffic.

tagLinks: tag all the links.

Possible values: true / false

Default: true

Set to false if you do not want to tag the video links. It will reduce network traffic.

Note: changes will be lost when the script is updated.

Origins

YouTube Links greatly resembles YouTube HD Suite in both looks and functionality. I had been using it for a long time and like how it worked. I especially like the video link tagging; I could tell at a glance if a video was HD or not. Nowadays, almost every video is at least 720p.

When the script broke after YouTube changed its page format on 3rd August 2011, I decided to learn how it works and write my own from scratch. The first version was uploaded to userscripts.org on 12th Aug 2011.

Known Issues

Check for update does not work in Firefox (since FF 29).

Changes

1.93 (Jun 2016)

  • Fixed sig-81.

1.92 (Apr 2016)

  • Added @connect for Tampermonkey.
  • Show "Opus" audio format.

1.91 (Dec 2015)

  • Updated VEVO sig detection 3.

1.90 (Dec 2015)

  • Bugfix (1.10): Fixed dangling pop-up on missed mouseout event.
  • Bugfix (1.40): Remove dangling header in non-watch pages.

1.88 (Nov 2015)

  • Updated VEVO sig detection 2.

1.87 (Nov 2015)

  • Updated VEVO sig detection.

1.86 (Sep 2015)

  • Add VP9/VOR format.

1.85 (Jun 2015)

  • Label 8K videos.

1.84 (May 2015)

  • Set download filename. Does not work in Firefox.

1.83 (Jan 2015)

  • Bugfix (1.32): Detect 4:3 AR properly.

1.82 (Nov 2014)

  • Fixed VEVO videos on TamperMonkey.

1.81 (Nov 2014)

  • Updated VEVO sig detection.

1.80 (Nov 2014)

  • Change HFR criteria to >45fps.
  • Tag video links in HTML 5 player video wall.
  • Add >=1080p videos from DASH manifest.
  • Remove <96kbps audio if there is at least one above.
  • Use SI units for file size (10^3 instead of 2^10).
  • Bugfix (1.00): avoid running unnecessarily in iframe.
  • Bugfix (1.40): show bitrate properly (kbps instead of kB/s).
  • Bugfix (1.62): calculate aspect ratio of portrait-mode videos correctly.

1.71 (Nov 2014)

  • Add HFR (High Frame Rate) if >30fps.
  • Rename 1.5k to 2K and 2k to 4K.
  • Able to filter formats.

1.70 (Oct 2014)

  • Add 256kbps M4A.

1.64 (Oct 2014)

  • Fixed event handling on Firefox; broken after FF 29. Hovering and VidFmts btn now work.
  • Use video size from page if available. (Reduce network traffic)
  • Remove 144v/240v videos completely if 720p/1080p are present to eliminate unnecessary querying. (Reduce network traffic)

1.63 (Oct 2014)

  • Change link to Greasy Fork.
  • Fixed video thumbnail text; broken after YouTube update.
  • Improved support for obfuscated-sig videos; broken after YouTube update.
  • Hide 144v and 240v if 720p/1080p are present.
  • Check for update every 5 days (not tested on Greasy Fork).

1.62 (Mar 2014)

Taken directly from http://userscripts-mirror.org/scripts/show/110007.html