Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tiktok-stats

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tiktok-stats - npm Package Compare versions

Comparing version 1.0.4 to 1.5.0

src/Base.js

54

index.js

@@ -1,53 +0,3 @@

const fetch = require("node-fetch");
const puppeteer = require('puppeteer');
module.exports = async function(user) {
if(!user) return "Please specify an tiktok account.";
return new Promise(async resolve => {
const stats = await tiktokStats(user);
resolve(stats);
});
};
function tiktokStats(user){
user = user.replace("@", "");
return new Promise(async resolve => {
fetch("https://m.tiktok.com/api/user/detail/?aid=1988&app_name=tiktok_web&device_platform=web&referer=&user_agent=Mozilla%2F5.0+(X11%3B+Ubuntu%3B+Linux+x86_64%3B+rv:80.0)+Gecko%2F20100101+Firefox%2F80.0&cookie_enabled=true&screen_width=1440&screen_height=900&browser_language=fr&browser_platform=Linux+x86_64&browser_name=Mozilla&browser_version=5.0+(X11)&browser_online=true&ac=&timezone_name=Europe%2FParis&page_referer=https:%2F%2Fwww.tiktok.com%2Fforyou%3Flang%3Dfr&priority_region=&appId=1233&region=FR&appType=m&isAndroid=false&isMobile=false&isIOS=false&OS=linux&did=6871875086158251525&uniqueId="+user+"&language=fr&verifyFp=verify_kf0smnxh_9V3Lwn0B_K0E4_4oTD_9QCv_HvDRDM7aPimn&_signature=_02B4Z6wo00d01f7.EswAAIBAvD3F6kmG9lH-.hZAACDkf0", {
"credentials": "include",
"headers": {
"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:80.0) Gecko/20100101 Firefox/80.0",
"Accept": "application/json, text/plain, */*",
"Accept-Language": "fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3"
},
"referrer": "https://www.tiktok.com/@"+user+"?lang=fr",
"method": "GET",
"mode": "cors"
}).then(res => {
if(!res || res.size <= 0) resolve("The user has no stats / does not exist.")
res.json().then(data =>{
if(data.statusCode == 10202) resolve("The user does not exist.");
const userInfo = data.userInfo.user;
const statsUser = data.userInfo.stats;
const profil = {
'user':{
'username': userInfo.nickname,
'profileName': userInfo.uniqueId,
'avatar': userInfo.avatarMedium,
'description': userInfo.signature,
'verified': userInfo.verified,
'private': userInfo.privateAccount
},
'stats':{
'following': statsUser.followingCount,
'follower': statsUser.followerCount,
'like': statsUser.heartCount,
'videoCount': statsUser.videoCount,
'diggCount': statsUser.diggCount
}
}
resolve(profil)
})
})
})
}
module.exports.Stats = require('./src/stats');
{
"name": "tiktok-stats",
"version": "1.0.4",
"version": "1.5.0",
"description": "This package gives you the statistics of which user tiktok !",

@@ -17,4 +17,4 @@ "main": "index.js",

"dependencies": {
"node-fetch": "^2.6.1"
"puppeteer": "^5.3.0"
}
}

@@ -21,5 +21,4 @@ # tiktok-stats

tiktokStats("tiktok_account_to_verify").then(result => {
console.log(result) // Return all accounts informations
})
const stats = await new tiktokStats.Stats("account").getStats();
console.log(stats) // Return all accounts informations
```

@@ -30,13 +29,11 @@

Exemple of return :
```
```json
{
user: {
username: 'Pioupia',
profileName: 'pioupia_dev',
avatar: 'https://p16-sg.tiktokcdn.com/aweme/720x720/tos-alisg-avt-0068/f8ca5ba97d27cb3f90c02afc140bc7db.jpeg',
description: 'Développeur de site web & de bots Discord.',
verified: false,
private: false
"user": {
"username": "Pioupia",
"profileName": "pioupia_dev",
"avatar": "https://p77-sign-sg.tiktokcdn.com/aweme/720x720/tos-alisg-avt-0068/f8ca5ba97d27cb3f90c02afc140bc7db.jpeg?x-expires=1605636000&x-signature=0awvFhUVv82Kj%2BZtDEG%2B8WKYAYw%3D",
"description": "Développeur de site web & de bots Discord."
},
stats: { following: 2, follower: 1, like: 29, videoCount: 2, diggCount: 0 }
"stats": { "following": 2, "follower": 1, "like": 29 }
}

@@ -46,5 +43,13 @@ ```

If the user does not exist, package return :
'The user does not exist'
```json
{
"code": 404,
"error": "This account cannot be found"
}
```
## Credits
Made by Pioupia with ❤️
## Contributing

@@ -51,0 +56,0 @@ Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc