Overview
This article lists and explains the available commands within the Parser code for writing a scraper using the IDE.
Commands marked with a star ⭐ are proprietary functions developed by Bright Data.
input
Global variable available to the parser code
let url = input.url;
$
An instance of cheerio
$('#example').text()
$('$example').attr('href')
$('#example').text_sane(); /* This is like $().text() but also trims text and replace all space characters with single space "a b \t\n\n c" -> "a b c" */
Find more information on the cheerio website.
location
A global variable available to the parser code. Object with info about current location
let current_url = location.href; // "https://example.com/"
Image
Collect image data
let i = new Image('https://example.com/image.png');
collect({image: i});
Video
Collect video data
let v = new Video('https://example.com/video.mp4');
collect({video: v});
Money
Collect price/money data
let p = new Money(10, 'USD');
collect({product_price: p});