This is a simple API wrapper and scraper for use with Somjik's TikTok mobile API.
To get started, you will need to install Node.js and Yarn.
Then, clone the repository and install the dependencies.
git clone https://github.com/james-elicx/tiktok-scraper-api
cd tiktok-scraper-api
yarn install
To use the API wrapper or scraper, you will need to create a .env
file in the root directory with the following variables:
API_KEY=<your rapidapi key>
The scraper is located in src/libs/tiktok-scraper.ts
. It is a simple scraper that uses the API wrapper.
Run the program with yarn start
to see the available arguments.
TikTok Scraper v1.0.0
Available arguments:
User Posts - Scrape a user's posts
--posts, -P <username | user id>
Data Path - Directory to save scraped data
--path, -D <path>
yarn start --posts tiktok --path ./scraped/
The API wrapper is located in src/libs/tiktok-api.ts
. It is a simple wrapper around Somjik's TikTok mobile API and is not affiliated with Somjik or TikTok in any way.
- Get user posts (
/v1/post/user/{userId}/posts
->user.getPosts
) - Get user info (
/v1/user/{userId}
->user.getInfo
) - Get user ID (
/v1/user/username/{username}
->user.getUserId
)