Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.