@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.
Files changed (122) hide show
  1. package/CHANGELOG.md +492 -0
  2. package/CODE_OF_CONDUCT.md +128 -0
  3. package/CONTRIBUTING.md +95 -0
  4. package/LICENSE +201 -0
  5. package/README.md +1663 -0
  6. package/bun.lock +367 -0
  7. package/helper/signature.js +390 -0
  8. package/helper/webmssdk.js +4586 -0
  9. package/helper/xbogus.js +563 -0
  10. package/install.sh +51 -0
  11. package/lib/cli/index.d.ts +2 -0
  12. package/lib/cli/index.js +809 -0
  13. package/lib/constants/api.d.ts +22 -0
  14. package/lib/constants/api.js +39 -0
  15. package/lib/constants/headers.d.ts +2 -0
  16. package/lib/constants/headers.js +5 -0
  17. package/lib/constants/index.d.ts +23 -0
  18. package/lib/constants/index.js +26 -0
  19. package/lib/constants/params.d.ts +19 -0
  20. package/lib/constants/params.js +531 -0
  21. package/lib/index.d.ts +93 -0
  22. package/lib/index.js +137 -0
  23. package/lib/lib/logger.d.ts +8 -0
  24. package/lib/lib/logger.js +25 -0
  25. package/lib/services/cookieManager.d.ts +10 -0
  26. package/lib/services/cookieManager.js +51 -0
  27. package/lib/services/downloadManager.d.ts +5 -0
  28. package/lib/services/downloadManager.js +188 -0
  29. package/lib/services/tiktokService.d.ts +14 -0
  30. package/lib/services/tiktokService.js +78 -0
  31. package/lib/types/common.d.ts +65 -0
  32. package/lib/types/common.js +2 -0
  33. package/lib/types/cookieManager.d.ts +13 -0
  34. package/lib/types/cookieManager.js +2 -0
  35. package/lib/types/downloader/musicaldownDownloader.d.ts +27 -0
  36. package/lib/types/downloader/musicaldownDownloader.js +2 -0
  37. package/lib/types/downloader/ssstikDownloader.d.ts +30 -0
  38. package/lib/types/downloader/ssstikDownloader.js +2 -0
  39. package/lib/types/downloader/tiktokApiDownloader.d.ts +38 -0
  40. package/lib/types/downloader/tiktokApiDownloader.js +2 -0
  41. package/lib/types/get/getCollection.d.ts +53 -0
  42. package/lib/types/get/getCollection.js +2 -0
  43. package/lib/types/get/getComments.d.ts +26 -0
  44. package/lib/types/get/getComments.js +2 -0
  45. package/lib/types/get/getMusicDetail.d.ts +49 -0
  46. package/lib/types/get/getMusicDetail.js +2 -0
  47. package/lib/types/get/getMusicVideos.d.ts +93 -0
  48. package/lib/types/get/getMusicVideos.js +2 -0
  49. package/lib/types/get/getPlaylist.d.ts +65 -0
  50. package/lib/types/get/getPlaylist.js +2 -0
  51. package/lib/types/get/getProfile.d.ts +71 -0
  52. package/lib/types/get/getProfile.js +2 -0
  53. package/lib/types/get/getTrendings.d.ts +61 -0
  54. package/lib/types/get/getTrendings.js +2 -0
  55. package/lib/types/get/getUserLiked.d.ts +90 -0
  56. package/lib/types/get/getUserLiked.js +2 -0
  57. package/lib/types/get/getUserPosts.d.ts +68 -0
  58. package/lib/types/get/getUserPosts.js +2 -0
  59. package/lib/types/get/getUserReposts.d.ts +104 -0
  60. package/lib/types/get/getUserReposts.js +2 -0
  61. package/lib/types/search/index.d.ts +15 -0
  62. package/lib/types/search/index.js +2 -0
  63. package/lib/types/search/liveSearch.d.ts +48 -0
  64. package/lib/types/search/liveSearch.js +2 -0
  65. package/lib/types/search/userSearch.d.ts +32 -0
  66. package/lib/types/search/userSearch.js +2 -0
  67. package/lib/types/search/videoSearch.d.ts +62 -0
  68. package/lib/types/search/videoSearch.js +2 -0
  69. package/lib/utils/downloader/musicaldownDownloader.d.ts +2 -0
  70. package/lib/utils/downloader/musicaldownDownloader.js +193 -0
  71. package/lib/utils/downloader/ssstikDownloader.d.ts +2 -0
  72. package/lib/utils/downloader/ssstikDownloader.js +177 -0
  73. package/lib/utils/downloader/tiktokAPIDownloader.d.ts +3 -0
  74. package/lib/utils/downloader/tiktokAPIDownloader.js +221 -0
  75. package/lib/utils/get/getCollection.d.ts +7 -0
  76. package/lib/utils/get/getCollection.js +113 -0
  77. package/lib/utils/get/getComments.d.ts +2 -0
  78. package/lib/utils/get/getComments.js +139 -0
  79. package/lib/utils/get/getMusicDetail.d.ts +2 -0
  80. package/lib/utils/get/getMusicDetail.js +68 -0
  81. package/lib/utils/get/getMusicVideos.d.ts +2 -0
  82. package/lib/utils/get/getMusicVideos.js +249 -0
  83. package/lib/utils/get/getPlaylist.d.ts +7 -0
  84. package/lib/utils/get/getPlaylist.js +115 -0
  85. package/lib/utils/get/getProfile.d.ts +2 -0
  86. package/lib/utils/get/getProfile.js +92 -0
  87. package/lib/utils/get/getTrendings.d.ts +7 -0
  88. package/lib/utils/get/getTrendings.js +120 -0
  89. package/lib/utils/get/getUserLiked.d.ts +2 -0
  90. package/lib/utils/get/getUserLiked.js +204 -0
  91. package/lib/utils/get/getUserPosts.d.ts +2 -0
  92. package/lib/utils/get/getUserPosts.js +199 -0
  93. package/lib/utils/get/getUserRepost.d.ts +2 -0
  94. package/lib/utils/get/getUserRepost.js +239 -0
  95. package/lib/utils/search/liveSearch.d.ts +2 -0
  96. package/lib/utils/search/liveSearch.js +99 -0
  97. package/lib/utils/search/userSearch.d.ts +2 -0
  98. package/lib/utils/search/userSearch.js +76 -0
  99. package/lib/utils/search/videoSearch.d.ts +2 -0
  100. package/lib/utils/search/videoSearch.js +140 -0
  101. package/lib/utils/urlExtractors.d.ts +3 -0
  102. package/lib/utils/urlExtractors.js +37 -0
  103. package/lib/utils/validator.d.ts +1 -0
  104. package/lib/utils/validator.js +13 -0
  105. package/package.json +60 -0
  106. package/test/collection-test.ts +73 -0
  107. package/test/comments-test.ts +54 -0
  108. package/test/downloader-v1-test.ts +49 -0
  109. package/test/downloader-v2-test.ts +47 -0
  110. package/test/downloader-v3-test.ts +35 -0
  111. package/test/music-detail-test.ts +97 -0
  112. package/test/music-videos-test.ts +86 -0
  113. package/test/playlist-test.ts +48 -0
  114. package/test/profile-test.ts +49 -0
  115. package/test/search-live-test.ts +42 -0
  116. package/test/search-user-test.ts +46 -0
  117. package/test/search-video-test.ts +53 -0
  118. package/test/trending-test.ts +128 -0
  119. package/test/userliked-test.ts +65 -0
  120. package/test/userposts-test.ts +56 -0
  121. package/test/userreposts-test.ts +57 -0
  122. 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