Getting Started
Step 1. Get Your Scrapeless API Key
- Create an account and log in to the Scrapeless Dashboard. You can get 2,000 Free API Calls.
- Generate your Scrapeless API key.
Step 2. Set trigger conditions and connect to Scrapeless
- Set the trigger conditions based on your actual needs.
- Connect your Scrapeless account. Here, we select Universal Scraping and use
https://www.amazon.com/LK-Apple-Watch-Screen-Protector/dp/B0DFG31G1P/
as a sample URL.
Step 3. Clean the Data
Next, we need to clean the HTML data scraped in the previous step. First, select Universal Scraping Data in the inputs section. The code configuration is as follows:
export const code = async (inputs) => {
const html = inputs.SOURCE_DATA
const titleMatch = html.match(/id=['"]productTitle['"][^>]*>([^<]+)</i);
const title = titleMatch ? titleMatch[1].trim() : "";
const priceMatch = html.match(/class=['"]a-offscreen['"][^>]*>\$?([\d.,]+)/i);
const price = priceMatch ? priceMatch[1].trim() : "";
const ratingMatch = html.match(/class=['"]a-icon-alt['"][^>]*>([^<]+)</i);
const rating = ratingMatch ? ratingMatch[1].trim() : "";
return [
{
json: {
title,
price,
rating
},
},
];
};
Step 4. Connect to Google Sheets
Next, you can choose to output the cleaned and structured data to Google Sheets. Simply add a Google Sheets node and configure your Google Sheets connection.
Note: Make sure to create a Google Sheet in advance.
Example of Output Results
That’s a simple tutorial on how to set up and use Scrapeless. If you have any questions, feel free to discuss them on Scrapeless Discord.