Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am wanting to find or create a Firefox Extension that can create and save to a folder, based upon the text in a page's tag.

I would want it to do the following:

  1. Check the page's html for a certain tag name (e.g. <itemName>),

  2. Use a regular expression to look for a text pattern within the tag mentioned above (e.g. first and last name like - <itemName>Abe Lincoln</itemName>),

  3. Compare that pattern to folders already existing on the computer,

    i. If the folder exists, then just save the file (from a certain domain, in certain tag, etc) from the page to that folder,

    ii. If the folder does not exist, then create it and then save the aforementioned file from the page to that folder.

  4. Close the page/tab.

I've been scouring the web for something like this, but as of yet, I haven't found something that can do this. Is there something like this? If not, is it possible to create an Extension that can work with Regular Expressions, like I need?

share|improve this question
Automatic Save Folder can use RegEx filters based on the file and domain names, but not on text inside the page. An extension that parses the page's contents and does what you want should be possible, but I don't know of any. Perhaps you can save all the pages in one location, then later run a script that parses them and moves them as required? – Karan Jul 13 '13 at 0:33
This would almost be more easily accomplished by using a language like Python and some web scraping modules like BeautifulSoup4. That way you have the full power of regex (Javascript's regex support is fairly mediocre, at best), and you can programmatically do what you want with the HTML and any associated files, like images, CSS, etc. – MattDMo Jul 13 '13 at 2:43

You must log in to answer this question.

Browse other questions tagged .