Support for MP4 Downloader has been discontinued.
I don't have the time anymore to keep up with all the breaking changes that Mozilla is making in add-on development for Firefox, in addition to reacting to changes in YouTube, Dailymotion, and Vimeo that affect video downloading. Since Mozilla dropped support for traditional add-ons in November 2017, MP4 Downloader has stopped working entirely in new versions of Firefox.
The codebase has been left in the middle of a complete rewrite (see the Source Code section of the Development page), although this rewrite is not anywhere close to what is required to support new versions of Firefox. That codebase, and this website, are left here for archival purposes.
To all MP4 Downloader fans, thanks for many years of support.
MP4 Downloader’s Selective Content Replacement allows MP4 Downloader file name and location preferences to be written in a special syntax in which certain values are substituted in for generic variable names. It also allows the use of “if statements” to control content.
If you are looking for a method of parsing strings using Selective Content Replacement, see the
parseString function in: http://www.mozdev.org/source/browse/mp4downloader/src/1.3.x/modules/util.jsm
%%VAR(two percent signs (%%) followed by the variable name).
Variables related to the video being downloaded:
%%TITLE- replaced with the current video’s title
%%AUTHOR- replaced with the current video’s author (may not be present on some videos)
%%HQ- replaced with 1 if the video is currently being downloaded in high-quality/high-definition or 0 if it is not (NOTE: The variable is
%%SITE- replaced with the current site from which the video is being downloaded
%%DOWNURL- replaced with the direct URL of the video
%%PAGEURL- replaced with the URL of the video page that the video was on (ie. http://www.youtube.com/watch?v=…)
%%DTA- replaced with 1 if DownThemAll is being used to download the video or 0 if it is not
Variables related to the current time and date:
%%YEAR- replaced with the current year (4 digits)
%%SHORTYEAR- replaced with the current year (2 digits)
%%MONTH- replaced with the current month (numerical - 1 or 2 digits)
%%FULLMONTH- replaced with the current month (full name - January, February, etc.)
%%SHORTMONTH- replaced with a 3-letter abbreviation for the current month (Jan, Feb, Mar, etc.)
%%DAY- replaced with the current day of the month (1 or 2 digits)
%%HOUR- replaced with the current 2-digit hour from a 12-hour clock (1 - 12)
%%FULLHOUR- replaced with the current 2-digit hour from a 24-hour clock (0 - 23)
%%MINUTE- replaced with the current 2-digit minute
%%SECOND- replaced with the current 2-digit second
[[if %%FULLHOUR matches ^(1[2-9]|2[0-3])$]]PM[[else]]AM[[endif]]
An if statement can be used to only show text if a certain variable has a certain value or matches a certain regular expression.
[[if %%VAR OPERAND VALUE]]stuff[[else]]other stuff[[endif]]
%%VARis a variable (see variables)
OPERANDis an operand (either “is”, “isnot”, “matches”, or “imatches” - see below)
VALUEis a string (or regular expression if
OPERANDis “matches” or “imatches”) that is compared to
All if statements should match this regular expression:
\[\[if %%[A-Z]+ (is|isnot|i?matches) .+\]\].*(\[\[else\]\].*)?\[\[endif\]\]
If statements compare a variable (
%%VAR) to a value (
VALUE) using the specified operand (
OPERAND). The if statement ends when it reaches
[[endif]]. An optional
[[else]] statement can be used to display something in the event that the if statement is evaluated to false.
]]can have unexpected results).
]]should not appear ANYWHERE inside if statements. This can also produce unexpected results.
[[if %%VAR is %%ANOTHERVAR]]stuff[[endif]]is invalid, although
[[if %%VAR is VALUE]]%%ANOTHERVAR[[endif]]is still OK).
[[if %%VAR is VALUE]]stuff to display[[endif]]
[[if %%VAR isnot VALUE]]stuff to display[[endif]]
[[if %%VAR matches REGEXP]]stuff to display[[endif]]
[[if %%VAR imatches REGEXP]]
NOTE: Be sure to escape any backslashes in if statements! Example:
[[if %%VAR matches .*\.js]] should be
[[if %%VAR matches .*\\.js]]
Default filename examples:
%%TITLE ([[if %%HQ is 1]]HD from [[endif]]%%SITE)will transform into My Awesome Video (YouTube) for a standard YouTube video or My Awesome Video (HD from YouTube) for an HD version of that video.
[[if %%TITLE matches (from|by) Bob$]]A video from my friend[[else]]%%TITLE[[endif]]will transform into A video from my friend for a video titled “blah blah from Bob” or “blah blah by Bob” or just the video title for any other video.