eklem / browsercrawler

Crawling content from a site within the browser. A basis for i.e. a search solution for static sites.

Home Page:https://eklem.github.io/browsercrawler/doc/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

selectors config file

eklem opened this issue · comments

Split out the selectors config to a .json-file so it's less scary to make it match your content. Should be required in the main.js file

Skip the require-step and just fetch the JSON file with the fetch API. Format of setup.json can be like this:

{
  "urls": [
    "https://example.com/1",
    "https://example.com/2",
    "https://example.com/3"
  ],
  "selectors": {
    "title": "$('title').text()",
    "body": "$('body').text()"
  }
}

Not a config file, but the crawler should take it as input, so a setup/config step