tiktok-stats
Advanced tools
Comparing version 1.0.4 to 1.5.0
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®ion=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. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
5
60
58
0
4004
+ Addedpuppeteer@^5.3.0
+ Added@types/node@22.9.3(transitive)
+ Added@types/yauzl@2.10.3(transitive)
+ Addedagent-base@5.1.1(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbase64-js@1.5.1(transitive)
+ Addedbl@4.1.0(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedbuffer@5.7.1(transitive)
+ Addedbuffer-crc32@0.2.13(transitive)
+ Addedchownr@1.1.4(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addeddebug@4.3.7(transitive)
+ Addeddevtools-protocol@0.0.818844(transitive)
+ Addedend-of-stream@1.4.4(transitive)
+ Addedextract-zip@2.0.1(transitive)
+ Addedfd-slicer@1.1.0(transitive)
+ Addedfind-up@4.1.0(transitive)
+ Addedfs-constants@1.0.0(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedget-stream@5.2.0(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedhttps-proxy-agent@4.0.0(transitive)
+ Addedieee754@1.2.1(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedlocate-path@5.0.0(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedmkdirp-classic@0.5.3(transitive)
+ Addedms@2.1.3(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedp-limit@2.3.0(transitive)
+ Addedp-locate@4.1.0(transitive)
+ Addedp-try@2.2.0(transitive)
+ Addedpath-exists@4.0.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedpend@1.2.0(transitive)
+ Addedpkg-dir@4.2.0(transitive)
+ Addedprogress@2.0.3(transitive)
+ Addedproxy-from-env@1.1.0(transitive)
+ Addedpump@3.0.2(transitive)
+ Addedpuppeteer@5.5.0(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedrimraf@3.0.2(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedstring_decoder@1.3.0(transitive)
+ Addedtar-fs@2.1.1(transitive)
+ Addedtar-stream@2.2.0(transitive)
+ Addedthrough@2.3.8(transitive)
+ Addedunbzip2-stream@1.4.3(transitive)
+ Addedundici-types@6.19.8(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedwrappy@1.0.2(transitive)
+ Addedws@7.5.10(transitive)
+ Addedyauzl@2.10.0(transitive)
- Removednode-fetch@^2.6.1