npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@xct007/tiktok-scraper

v1.0.2

Published

Tiktok scraper for Node.js

Downloads

10,974

Readme


Tiktok Video Fetcher

This project provides a TypeScript module for fetching and parsing TikTok videos and user profiles. The module allows you to fetch raw data from TikTok and optionally parse the data into a structured format, including the ability to dynamically add specific properties from the fetched data to the parsed result.

Features

  • Fetch TikTok Data: Retrieve raw data for TikTok videos and user profiles.
  • Parse Data: Optionally parse the fetched data into a structured format.
  • Dynamic Key Inclusion: Add specific properties from the fetched data to the parsed result.

Installation

To install the dependencies and use the module, run:

npm install @xct007/tiktok-scraper

Usage

Here’s how you can use the module to fetch and parse TikTok video data:

Fetch Raw Data

import Tiktok from "@xct007/tiktok-scraper";

Tiktok("https://vt.tiktok.com/ZGJBtcsDq/", {
	// Without parse option
	// The raw data will be returned
	parse: false,
})
	.then((data) => {
		console.log("Aweme List:", data);
	})
	.catch((error) => {
		console.error(error);
	});

Parse Data with Specific Keys

You can specify the keys you want to include in the parsed result:

import Tiktok from "@xct007/tiktok-scraper";

Tiktok("https://vt.tiktok.com/ZGJBtcsDq/", {
	parse: true,
	keys: ["desc_language"],
})
	.then((data) => {
		// The desc_language key
		// will be included in the parsed result
		console.log("Parsed Data:", data.desc_language);
	})
	.catch((error) => {
		console.error(error);
	});

API

Tiktok(url: string, options?: ITiktokOptions): Promise<Aweme[] | IParsed | Partial<IParsed>>

Fetches TikTok video or user profile data based on the provided URL.

  • url: The URL of the TikTok video or user profile.
  • options: Optional configuration options:
    • parse: boolean - If true, the data will be parsed, otherwise the raw data will be returned.
    • keys: Array<keyof Aweme> - Specify the keys to include in the parsed result.

Returns a Promise that resolves to either an array of Aweme objects, a full IParsed object, or a Partial<IParsed> object if keys are specified.

IParsed

An interface that defines the structure of the parsed TikTok data. This structure can be extended dynamically based on the specified keys.

Contributing

If you’d like to contribute to this project, feel free to submit a pull request or open an issue.

Credits

This project was developed by FrierenDv.

License

This project is licensed under the MIT License.