Firefox cache2 Extractor is useful for downloading some content you find in your every day use of your favourite browser, such as pictures or PDF documents for instance.

It will parse your Firefox cache files, filter them according to the rules you provide (as regular expressions on the URL, file extension, file signature) and save them where you want, named as you want.

It has been developed to replace the Cache Download legacy extension since Mozilla Firefox from its version 57 now only supports WebExtensions.

Firefox cache2 Extractor works besides the browser as a compiled Python script. Python being a cross-platform language, this script is ported to Windows and Linux. Porting to Mac is possible.

Features

  • Filter by URL with regular expression
  • Filter by file extension
  • Filter by file signature by providing MIME type
  • Define output file path with date and regular expression group
  • GZIP compressed content is automatically extracted

Releases

Usage

Download the version according to your system, extract it then open a terminal and run:

firefox-cache2-extractor-console.exe [-h] [-p PROFILE] [-r RULES] [-t FILETYPES] [-e EXTRACT] [-w WAIT] [-f FILE] [-d DIRECTORY] [-s] [-v] [-l LOGLEVEL] [--user USER] [--password PASSWORD] [--dry]

By default, files will be extracted in a folder called 'cache2' in the directory where you installed this script. To use a different location, provide parameter -e OUTPUT_PATH.

To start Firefox when firing this script, use parameter -s. The script will then terminate shortly after you closed Firefox.

If several Firefox profiles are found, you'll need to explicitly tell the script the one that should be used by providing parameter -p abcde12.default.

If you don't own a licence, the extracted files will be empty. Please provide your credentials to the command line with parameters --user [email protected] --password YOUR_PASSWORD or contact me to register.

When you're done with configuration and checking, you can create a shortcut or launcher that will call the GUI version instead of the console one.

firefox-cache2-extractor-gui.exe [-h] [-p PROFILE] [-r RULES] [-t FILETYPES] [-e EXTRACT] [-w WAIT] [-f FILE] [-d DIRECTORY] [-s] [-v] [-l LOGLEVEL] [--user USER] [--password PASSWORD] [--dry]

Only Window version supports the GUI which consists of a system tray icon that can be right clicked for checking the log or changing the rules.

Rules

By default, the script will download all the images you've seen from 9gag.

Rules are defined in a CSV file. By default it is 'rules.csv'. Make a copy of it, name it say 'myrules.csv' and use parameter -r myrules.csv. Open it as a text file. Each line is a rule except the lines that start with '#' that are comments. The fields (URL Regular Expression, Extension, Filetype, Filename) are separated by tabulations.

Cache elements are saved according to 3 conditions :

  • URL regular expression
  • File extension (like jpg,jpeg)
  • File signature (useful if file has no extension, is wrong or to double check). You actually provide a MIME type like 'image/jpeg' that is translated in file signature 'FF D8' in this case according to 'filetypes.csv'.

Output file name is defined in the last field. You can use any group from the regular expression, the actual content filename, the cache filename or the file modification date as <year>-<month>-<day>-<hour>-<minute>-<second>. Folders will be created if necessary. Relative path is defined with parameter -e OUTPUT_PATH as explained above.

Tips

  • Configure Firefox to clear the cache when closing so that it does not get too big for the next time the script will have to loop over all the cache files at start-up. It is not necessary but it will anyway improve Firefox performance and your browsing experience.
  • Create a shortcut or launcher that will call this script and launch Firefox (use parameter -s)
  • Check your regular expressions online on https://regex101.com
  • To help you in finding the URLs you're looking for, use parameter --dry: it will produce a report as a CSV file. You can also use Firefox Media Info window.

Tested on

Windows 10 64-bit

Ubuntu 17.10 64-bit

Credits

Author is DjZU [[email protected]]

Icon made of icon Firefox by Pixel Buddha and Down Arrow by Smashicons from www.flaticon.com

Not related in any way with Mozilla.

Add a comment