Local Storage

localStorage: object | {};

What's This?

Local storage is like a small memory space websites use to save settings or data on your device. This can be things like your preferred website theme (light or dark mode) or the progress in a game. The localStorage option allows you to set specific local storage data for the scraper to use when it visits a website..

Properties

-key: The name or identifier for the piece of data in local storage.

-value: The actual data or setting you want to store under that name.

How Does it Work?

By default, the scraper doesn't use any special local storage data. But if you provide it:

  • Default (localStorage=): No custom local storage data is set for the request.

  • Example: If you set localStorage= {key: "theme", value: "dark"}, the scraper will visit the website with the "dark" theme setting, if the site supports it.

When Should I Use This?

If you want the scraper to see a website with specific settings or data saved in local storage, use the localStorage option. It helps the scraper view the website in a way that matches certain user preferences or saved data.

Methods

addLocalStorageItem(key, value) 

Configuration Name: localStorage

Initializing Scraper

const GeonodeScraperApi = require('geonode-scraper-api');
const scraper = new GeonodeScraperApi('<Your_username>', '<Your_password>');

Using Method

scraper.addLocalStorageItem('key1', 'cookie1');
scraper.addLocalStorageItem('value1', 'val1');
scraper.scrape('https://example.com/');

Using Configuration Object

const config = { localStorage: { key1: 'cookie1', value1: 'val1' } };
scraper.scrape('https://example.com/', config);