@nxgiang/tiktok-api 1.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +492 -0
- package/CODE_OF_CONDUCT.md +128 -0
- package/CONTRIBUTING.md +95 -0
- package/LICENSE +201 -0
- package/README.md +1663 -0
- package/bun.lock +367 -0
- package/helper/signature.js +390 -0
- package/helper/webmssdk.js +4586 -0
- package/helper/xbogus.js +563 -0
- package/install.sh +51 -0
- package/lib/cli/index.d.ts +2 -0
- package/lib/cli/index.js +809 -0
- package/lib/constants/api.d.ts +22 -0
- package/lib/constants/api.js +39 -0
- package/lib/constants/headers.d.ts +2 -0
- package/lib/constants/headers.js +5 -0
- package/lib/constants/index.d.ts +23 -0
- package/lib/constants/index.js +26 -0
- package/lib/constants/params.d.ts +19 -0
- package/lib/constants/params.js +531 -0
- package/lib/index.d.ts +93 -0
- package/lib/index.js +137 -0
- package/lib/lib/logger.d.ts +8 -0
- package/lib/lib/logger.js +25 -0
- package/lib/services/cookieManager.d.ts +10 -0
- package/lib/services/cookieManager.js +51 -0
- package/lib/services/downloadManager.d.ts +5 -0
- package/lib/services/downloadManager.js +188 -0
- package/lib/services/tiktokService.d.ts +14 -0
- package/lib/services/tiktokService.js +78 -0
- package/lib/types/common.d.ts +65 -0
- package/lib/types/common.js +2 -0
- package/lib/types/cookieManager.d.ts +13 -0
- package/lib/types/cookieManager.js +2 -0
- package/lib/types/downloader/musicaldownDownloader.d.ts +27 -0
- package/lib/types/downloader/musicaldownDownloader.js +2 -0
- package/lib/types/downloader/ssstikDownloader.d.ts +30 -0
- package/lib/types/downloader/ssstikDownloader.js +2 -0
- package/lib/types/downloader/tiktokApiDownloader.d.ts +38 -0
- package/lib/types/downloader/tiktokApiDownloader.js +2 -0
- package/lib/types/get/getCollection.d.ts +53 -0
- package/lib/types/get/getCollection.js +2 -0
- package/lib/types/get/getComments.d.ts +26 -0
- package/lib/types/get/getComments.js +2 -0
- package/lib/types/get/getMusicDetail.d.ts +49 -0
- package/lib/types/get/getMusicDetail.js +2 -0
- package/lib/types/get/getMusicVideos.d.ts +93 -0
- package/lib/types/get/getMusicVideos.js +2 -0
- package/lib/types/get/getPlaylist.d.ts +65 -0
- package/lib/types/get/getPlaylist.js +2 -0
- package/lib/types/get/getProfile.d.ts +71 -0
- package/lib/types/get/getProfile.js +2 -0
- package/lib/types/get/getTrendings.d.ts +61 -0
- package/lib/types/get/getTrendings.js +2 -0
- package/lib/types/get/getUserLiked.d.ts +90 -0
- package/lib/types/get/getUserLiked.js +2 -0
- package/lib/types/get/getUserPosts.d.ts +68 -0
- package/lib/types/get/getUserPosts.js +2 -0
- package/lib/types/get/getUserReposts.d.ts +104 -0
- package/lib/types/get/getUserReposts.js +2 -0
- package/lib/types/search/index.d.ts +15 -0
- package/lib/types/search/index.js +2 -0
- package/lib/types/search/liveSearch.d.ts +48 -0
- package/lib/types/search/liveSearch.js +2 -0
- package/lib/types/search/userSearch.d.ts +32 -0
- package/lib/types/search/userSearch.js +2 -0
- package/lib/types/search/videoSearch.d.ts +62 -0
- package/lib/types/search/videoSearch.js +2 -0
- package/lib/utils/downloader/musicaldownDownloader.d.ts +2 -0
- package/lib/utils/downloader/musicaldownDownloader.js +193 -0
- package/lib/utils/downloader/ssstikDownloader.d.ts +2 -0
- package/lib/utils/downloader/ssstikDownloader.js +177 -0
- package/lib/utils/downloader/tiktokAPIDownloader.d.ts +3 -0
- package/lib/utils/downloader/tiktokAPIDownloader.js +221 -0
- package/lib/utils/get/getCollection.d.ts +7 -0
- package/lib/utils/get/getCollection.js +113 -0
- package/lib/utils/get/getComments.d.ts +2 -0
- package/lib/utils/get/getComments.js +139 -0
- package/lib/utils/get/getMusicDetail.d.ts +2 -0
- package/lib/utils/get/getMusicDetail.js +68 -0
- package/lib/utils/get/getMusicVideos.d.ts +2 -0
- package/lib/utils/get/getMusicVideos.js +249 -0
- package/lib/utils/get/getPlaylist.d.ts +7 -0
- package/lib/utils/get/getPlaylist.js +115 -0
- package/lib/utils/get/getProfile.d.ts +2 -0
- package/lib/utils/get/getProfile.js +92 -0
- package/lib/utils/get/getTrendings.d.ts +7 -0
- package/lib/utils/get/getTrendings.js +120 -0
- package/lib/utils/get/getUserLiked.d.ts +2 -0
- package/lib/utils/get/getUserLiked.js +204 -0
- package/lib/utils/get/getUserPosts.d.ts +2 -0
- package/lib/utils/get/getUserPosts.js +199 -0
- package/lib/utils/get/getUserRepost.d.ts +2 -0
- package/lib/utils/get/getUserRepost.js +239 -0
- package/lib/utils/search/liveSearch.d.ts +2 -0
- package/lib/utils/search/liveSearch.js +99 -0
- package/lib/utils/search/userSearch.d.ts +2 -0
- package/lib/utils/search/userSearch.js +76 -0
- package/lib/utils/search/videoSearch.d.ts +2 -0
- package/lib/utils/search/videoSearch.js +140 -0
- package/lib/utils/urlExtractors.d.ts +3 -0
- package/lib/utils/urlExtractors.js +37 -0
- package/lib/utils/validator.d.ts +1 -0
- package/lib/utils/validator.js +13 -0
- package/package.json +60 -0
- package/test/collection-test.ts +73 -0
- package/test/comments-test.ts +54 -0
- package/test/downloader-v1-test.ts +49 -0
- package/test/downloader-v2-test.ts +47 -0
- package/test/downloader-v3-test.ts +35 -0
- package/test/music-detail-test.ts +97 -0
- package/test/music-videos-test.ts +86 -0
- package/test/playlist-test.ts +48 -0
- package/test/profile-test.ts +49 -0
- package/test/search-live-test.ts +42 -0
- package/test/search-user-test.ts +46 -0
- package/test/search-video-test.ts +53 -0
- package/test/trending-test.ts +128 -0
- package/test/userliked-test.ts +65 -0
- package/test/userposts-test.ts +56 -0
- package/test/userreposts-test.ts +57 -0
- package/tobyg74-tiktok-api-1.3.7.tgz +0 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Test for Tiktok Get User Posts
|
|
2
|
+
import Tiktok from "../src/index"
|
|
3
|
+
|
|
4
|
+
async function testUserPosts() {
|
|
5
|
+
try {
|
|
6
|
+
const username = "Tobz2k19" // Change to a valid TikTok username
|
|
7
|
+
const result = await Tiktok.GetUserPosts(username, {
|
|
8
|
+
postLimit: 30,
|
|
9
|
+
proxy: undefined
|
|
10
|
+
})
|
|
11
|
+
if (result.status === "success" && result.result) {
|
|
12
|
+
console.log("\nUser Posts fetched successfully!")
|
|
13
|
+
console.log("========================")
|
|
14
|
+
console.log("Posts Overview:")
|
|
15
|
+
console.log("========================")
|
|
16
|
+
console.log(`Total posts fetched: ${result.result.length}`)
|
|
17
|
+
|
|
18
|
+
result.result.forEach((post, index) => {
|
|
19
|
+
console.log(`\nPost ${index + 1}:`)
|
|
20
|
+
console.log("-------------------")
|
|
21
|
+
console.log(`ID: ${post.id}`)
|
|
22
|
+
console.log(`Description: ${post.desc}`)
|
|
23
|
+
if (post.author) {
|
|
24
|
+
console.log(
|
|
25
|
+
`Author: ${post.author.nickname} (@${post.author.username})`
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
if (post.createTime) {
|
|
29
|
+
console.log(
|
|
30
|
+
`Created: ${new Date(post.createTime * 1000).toLocaleString()}`
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
if (post.stats) {
|
|
34
|
+
console.log("Statistics:")
|
|
35
|
+
console.log(`- Likes: ${post.stats.likeCount}`)
|
|
36
|
+
console.log(`- Comments: ${post.stats.commentCount}`)
|
|
37
|
+
console.log(`- Shares: ${post.stats.shareCount}`)
|
|
38
|
+
console.log(`- Plays: ${post.stats.playCount}`)
|
|
39
|
+
}
|
|
40
|
+
if (post.video?.playAddr) {
|
|
41
|
+
console.log(`Video URL: ${post.video.playAddr}`)
|
|
42
|
+
}
|
|
43
|
+
if (post.imagePost?.length) {
|
|
44
|
+
console.log(`Images: ${post.imagePost.join(", ")}`)
|
|
45
|
+
}
|
|
46
|
+
console.log("========================")
|
|
47
|
+
})
|
|
48
|
+
} else {
|
|
49
|
+
console.error("Error:", result.message)
|
|
50
|
+
}
|
|
51
|
+
} catch (error) {
|
|
52
|
+
console.error("Test failed:", error)
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
testUserPosts()
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Test for Tiktok Get User Reposts
|
|
2
|
+
import Tiktok from "../src/index"
|
|
3
|
+
|
|
4
|
+
async function testUserReposts() {
|
|
5
|
+
try {
|
|
6
|
+
const username = "Tobz2k19" // Change to a valid TikTok username
|
|
7
|
+
const result = await Tiktok.GetUserReposts(username, {
|
|
8
|
+
postLimit: 30,
|
|
9
|
+
proxy: undefined
|
|
10
|
+
})
|
|
11
|
+
if (result.status === "success" && result.result) {
|
|
12
|
+
console.log("\nUser Reposts fetched successfully!")
|
|
13
|
+
console.log("========================")
|
|
14
|
+
console.log("Reposts Overview:")
|
|
15
|
+
console.log("========================")
|
|
16
|
+
console.log(`Total reposts fetched: ${result.result.length}`)
|
|
17
|
+
|
|
18
|
+
result.result.forEach((post, index) => {
|
|
19
|
+
console.log(`\nRepost ${index + 1}:`)
|
|
20
|
+
console.log("-------------------")
|
|
21
|
+
console.log(`ID: ${post.id}`)
|
|
22
|
+
console.log(`Description: ${post.desc}`)
|
|
23
|
+
if (post.author) {
|
|
24
|
+
console.log(
|
|
25
|
+
`Author: ${post.author.nickname} (@${post.author.username})`
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
console.log(
|
|
29
|
+
`Create Time: ${new Date(post.createTime * 1000).toLocaleString()}`
|
|
30
|
+
)
|
|
31
|
+
if (post.stats) {
|
|
32
|
+
console.log(`Share Count: ${post.stats.shareCount}`)
|
|
33
|
+
}
|
|
34
|
+
if (post.video) {
|
|
35
|
+
console.log(`Video Duration: ${post.video.duration}s`)
|
|
36
|
+
console.log(`Video Format: ${post.video.format}`)
|
|
37
|
+
}
|
|
38
|
+
if (
|
|
39
|
+
post.imagePost &&
|
|
40
|
+
post.imagePost.images &&
|
|
41
|
+
post.imagePost.images.length > 0
|
|
42
|
+
) {
|
|
43
|
+
console.log(`Image Post: ${post.imagePost.images.length} images`)
|
|
44
|
+
}
|
|
45
|
+
if (post.music && post.music.title) {
|
|
46
|
+
console.log(`Music: ${post.music.title}`)
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
} else {
|
|
50
|
+
console.error("Failed to fetch reposts:", result.message)
|
|
51
|
+
}
|
|
52
|
+
} catch (error) {
|
|
53
|
+
console.error("Error:", error)
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
testUserReposts()
|
|
Binary file
|