Map of selector functions.
This type is meant to be checked with an extended type, as users are going to implement a derived version of this for custom scrapers.
Creates a runner instance.
This method is called by the createScraper function, but can also be externally used if needed to use an external pino logger or prefer full control over the scraper options.
The runner logger and options.
The scraper runner.
When executed, it will fetch the base url and build a JSDOM using the received HTML payload in order to make a virtual window and document available for scraping.
Once these are ready, the scraper will start to spawn promise pools to deal with more intensive tasks, such as pagination, node scraping and selector scraping in parallel.
All these settings will depend on the options given during the creation of the scraper struct.
A mapped type based on the given selectors.
The strict mode boolean type. Used to tweak the scrape result type strictness.
The scraping runner properties and selectors.
result Type-safe scraping results based on the given selectors and strict mode.
Creates a new scraper runner.
This method is papercut entrypoint. It will create an Scraper struct containing a runner that you can tweak as needed.
The runner is going to abide to the settings given during the creation of this object.
This function will also create a pino logger and embed it within the runner.
In case you prefer to manage the logger yourself,
please use createRunner
instead.
The scraper runner.
When executed, it will fetch the base url and build a JSDOM using the received HTML payload in order to make a virtual window and document available for scraping.
Once these are ready, the scraper will start to spawn promise pools to deal with more intensive tasks, such as pagination, node scraping and selector scraping in parallel.
All these settings will depend on the options given during the creation of the scraper struct.
A mapped type based on the given selectors.
The strict mode boolean type. Used to tweak the scrape result type strictness.
The scraping runner properties and selectors.
result Type-safe scraping results based on the given selectors and strict mode.
This method creates the selector utilities provided to every selector function given to the scrape method.
These utilities are meant to make the experience of using papercut a bit more pleasant. They're currently not extendable, but one could, in theory, create higher order functions extension.
Almost every single one of these methods have a default fallback of an empty string, in case it fails to find the element or a specific property.
At the same time, you also have direct access to the elementfrom selector functions if needed for more complex tasks.
the scrape function
this function will select all target nodes from the given document and spawn promise pools for triggering selector scraping.
this function is used by papercut runner with the managed jsdom instances.
if you want to have more control over jsdom
but still leverage papercut, you can use this
function directly instead of using createScraper
or createRunner
A mapped type based on the given selectors.
The strict mode boolean type. Used to tweak the scrape result type strictness.
The scraping properties and selectors.
Generated using TypeDoc
Function to be used when scraping the target node for specific data.