0

I'm trying to write an automated script that will enter a search query, say on example.com, and capture the query results (and then repeat a couple hundred times). How might I store the query results so that by the end of the script, I have a full list of results?

A better question might be, do google extension chromes operate independent of pages? While in browser JS wouldn't carry over to a new page (excepting cookies/sessions), do the Google Extensions remain running? Even so, other than printing to the console a whole list, where else can I place this material?

Thank you.

ZAR
  • 2,550
  • 4
  • 36
  • 66
  • Please read the [architecture overview](https://developer.chrome.com/extensions/overview) first. It will answer many questions. In addition to that, there are APIs to write files. – Xan Apr 08 '14 at 15:16
  • html5 local storage? chrome.storage for extension? – Skalár Wag Apr 08 '14 at 15:18
  • What do you want to do with the full list of results? What have you written so far? – Teepeemm Apr 08 '14 at 16:02
  • Thank you guys for commenting. @Xan, I've been combing the documentation and wasn't able to locate the correct api. They have all sorts of fun api's for changing elements in the current window, etc. but saving data off browser (or accessible off browser) i couldn't find. – ZAR Apr 08 '14 at 18:07
  • @Skalar Wag, I thought local storage would be the right fit, but I couldn't find good instruction for how to access this data store. – ZAR Apr 08 '14 at 18:07
  • @Teepeemm, I agree typically I should provide some code. But I'm currently scoping out my options and trying to figure out if a chrome extension is the way to go. I'd just like to have txt file. – ZAR Apr 08 '14 at 18:07

1 Answers1

0

@Skalar Wag, the chrome extension for storage was the right way to go. Found a different Q here that asked a similar question: Chrome extension: How to save a file on disk

More can be found on:

https://developer.chrome.com/apps/fileSystem

Thanks a lot guys and I apologize for the non-specificity

Community
  • 1
  • 1
ZAR
  • 2,550
  • 4
  • 36
  • 66
  • 1
    Not a good answer because this API is only for *apps*, not *extensions*. – Xan Apr 08 '14 at 18:38
  • 1
    You are confusing HTML5 fileSystem API and `chrome.fileSystem`. Also, take a look at `chrome.download`, which is available for extensions. – Xan Apr 08 '14 at 18:39
  • @Xan, you again are correct. In the documentation, I'm not finding a part that speaks about downloading from local storage. The method, download, takes in a URL to find the file. But this I imagine will be stored on local storage. However, reading further, saving to local storage is simple and extracting that file (locally) isn't difficult either. In this case, I'd only need to write to the local storage and retrieve it from one of chrome's user files. Is this correct? – ZAR Apr 08 '14 at 22:57
  • 1
    I thought you specifically want to output the result in a file. If you just need to manage data while you're executing, either `localStorage` or `chrome.storage` will do, maybe with `unlimitedStorage` permission to be safe. If you want to save some data in a file afterwards, you can [use a data URI](http://stackoverflow.com/questions/8693289/how-to-write-localstorage-data-to-a-text-file-in-chrome) and the answer linked above. – Xan Apr 08 '14 at 23:13
  • 1
    In fact, [this answer](http://stackoverflow.com/questions/7160720/create-a-file-using-javascript-in-chrome-on-client-side) is even better. – Xan Apr 08 '14 at 23:15