Hack #79. Easily Download Embedded Movies

Add a download link next to movies and Flash animations in web pages.

A little-known feature of Firefox is the Page Info dialog (under the Tools menu). Most people who try it can't get past the first tab, which displays geeky technical details of how the page was served. But if you click over to the Media tab, Firefox displays the URLs of all the multimedia objects on the page: images, QuickTime movies, and Flash animations. You can select the URL of a movie, copy it to the clipboard, and then paste it into a download manager or command-line tool to download it to your local computer.

OK, I guess that's still pretty geeky. Here's a simpler solution: this hack adds a download link next to each inline movie. You can right-click the download link and save the movie to your local computer—you know, the way the Web is supposed to work.

The Code

This user script runs on all pages. It uses the document.getElementsByTagName function to find movies embedded in the page with an <embed> tag. Then, it creates a download link that points to the embedded object's source file.

Save the following user script as unembed.user.js:

	// ==UserScript==
	// @name		  Unembed
	// @namespace	  http://neugierig.org/software/greasemonkey
	// @description	  Adds a download link to embedded movies // @include * // ==/UserScript // based on code by Evan Martin // published here with his gracious permission var arEmbed = document.getElementsByTagName('embed'); for (var i = arEmbed.length ...

Get Greasemonkey Hacks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.