What You'll Learn
- • Setting up your development environment
- • Installing the required HTTP client
- • Authenticating with the ScrapeCreators API
- • Making requests to TikTok
- • Handling responses and errors
- • Best practices for production use
Tutorial · TikTok
⚡️ Node.js Step-by-stepExtract profile data from TikTok. Real code, real responses, real production patterns — paste it into your project and ship.
Learn how to scrape TikTok profiles using Node.js. This comprehensive guide will walk you through the entire process, from setup to implementation.
First, you'll need a ScrapeCreators API key to authenticate your requests.
Sign up at app.scrapecreators.com to get your free API key with 100 requests.
Make sure you have the following installed:
Axios is a promise-based HTTP client for Node.js
npm install axiosNow let's make a request to the TikTok API using Node.js. Replace YOUR_API_KEY with your actual API key.
import axios from 'axios';
const API_KEY = 'YOUR_API_KEY';
async function scrape() {
try {
const response = await axios.get(`https://api.scrapecreators.com/v1/tiktok/profile?handle=stoolpresidente&user_id=6659752019493208069&cache_max_age=7d`, {
headers: {
'x-api-key': API_KEY,
'Content-Type': 'application/json'
}
});
console.log('Response:', response.data);
return response.data;
} catch (error) {
console.error('Error:', error.response?.data || error.message);
}
}
// Usage
scrape();This endpoint accepts the following parameters:
handleOptional(string)TikTok handle. You can pass handle or user_id.
Example: stoolpresidente
user_idOptional(string)TikTok user id.
Example: 6659752019493208069
cache_max_ageOptional(select)If we have a response in the cache that is this many days old or newer, return the cached response (0 credits). Otherwise, scrape a live result (1 credit). [See the Caching page for details.](https://docs.scrapecreators.com/caching)
Example: 7d
Execute your script to test the API connection. You should see a JSON response with TikTok profiles data.