Is there a Chrome extension that will save all viewed resources whose URL match a given expression?

5,955

Solution 1

I'm sorry, I haven't found an extension, but in linux you could raid google-chrome's cache for the images - if only from 1 site, clear your cache first then load the pages you want to get images from.

To find google's cache -- use your file manager (thunar / nautilus / whatever ) to navigate to /home/yourusername/.cache/google-chrome/Default/Cache (This is a hidden folder)

Now that you know where all those downloaded images and stuffs have gone lets see if we can get them out of there, and rename them with proper extensions (your gonna have to rename each one to something comprehensible) HERE Goes... -->

Example 1: to find JPEG files under /home/yourusername/.cache/google-chrome/Default/Cache

open a terminal... cd /home/yourusername/.cache/google-chrome/Default/Cache

 find -type f -print0 | xargs -0 file -i | grep -i JPEG | awk {'print $1'} | sed 's/^..//g' | sed 's/.$//g' > /tmp/FILESTOMOVE.txt

The command explained...

  1. find -type f = find files

  2. xarg -0 file -i = output the mime type

  3. grep -i JPEG = only show give me JPEG files

  4. awk {'print $1'} | sed 's/^..//g' | sed 's/.$//g' = tidy up file names

  5. > /tmp/FILESTOMOVE.txt = create a filelist for moving.

    Just change grep -i JPEG to PNG or GIF or FLASH etc --- the -i flag denotes case-insensitive (so you could just use grep -i jpeg / png / gif etc)

Now you have a list of files... I have a little command I use to move that list to somewhere.

#!/bin/bash

IFS=$'\n'
mkdir -p /home/yourusername/Downloads/saved_from_google_cache/
if [ -f /tmp/FILESTOMOVE.txt ];then
     cat /tmp/FILESTOMOVE.txt |
     while read newfile; 
     do
        mv $newfile /home/yourusername/Downloads/saved_from_google_cache/
    done
fi

Save it as move_google_cached in /usr/bin or /usr/sbin and chmod 755 move_google_cached

Solution 2

I ended up creating a Perl script using HTTP::Proxy. It was pretty easy using the examples, but there is the hassle of changing your proxy settings every time you need to use it.

Share:
5,955

Related videos on Youtube

Bribles
Author by

Bribles

Updated on September 17, 2022

Comments

  • Bribles
    Bribles over 1 year

    For example, if I wanted to save all PNG files that I come across in Wikipedia articles, I could enter

    *.wikipedia.org/*.png
    

    Or if I wanted to save any file with pony in the filename, I could use

    *pony*
    

    Does a Chrome extension that provides this functionality exist? Using either wildcards or full-fledged regular expressions for the pattern matching is fairly immaterial.

    • Dennis Williamson
      Dennis Williamson over 13 years
      nit: Those are wild-card or glob expressions. Do you want them or regexes? (not that I have an answer for you)
    • Bribles
      Bribles over 13 years
      Very fine nit indeed.
    • Bribles
      Bribles over 13 years
      I realize now that most extensions I've seen that do pattern matching use wildcards.
    • palbakulich
      palbakulich over 13 years
      Could elaborate on which extensions do pattern matching with wildcards? - I haven't come across any.