change to camelCase

This commit is contained in:
TobyG74 2023-04-08 17:30:02 +07:00
parent 93335c7159
commit a3f52ff459
4 changed files with 41 additions and 37 deletions

View File

@ -1,11 +1,11 @@
# Tiktok Downloader # Tiktok Downloader
- Used to download videos, images, music from TikTok - Used to download videos, images, music from TikTok
- No login or password are required - No login or password are required
## Installation ## Installation
- @tobyg74/tiktok-api-dl requires Node.js v10+ to run. - @tobyg74/tiktok-api-dl requires Node.js v10+ to run.
### Install from NPM ### Install from NPM
@ -24,27 +24,25 @@ yarn add @tobyg74/tiktok-api-dl
### Tiktok Downloader ### Tiktok Downloader
```js ```js
const { TiktokDL } = require("@tobyg74/tiktok-api-dl"); const { TiktokDL } = require("@tobyg74/tiktok-api-dl")
const tiktok_url = "https://vt.tiktok.com/ZS84BnrU9" const tiktok_url = "https://vt.tiktok.com/ZS84BnrU9"
TiktokDL(tiktok_url) TiktokDL(tiktok_url).then((result) => {
.then((result) => { console.log(result)
console.log(result); })
})
``` ```
### Tiktok Profile ### Tiktok Profile
```js ```js
const { TiktokStalk } = require("@tobyg74/tiktok-api-dl"); const { TiktokStalk } = require("@tobyg74/tiktok-api-dl")
const username = "tobz2k19" const username = "tobz2k19"
TiktokStalk(username) TiktokStalk(username).then((result) => {
.then((result) => { console.log(result)
console.log(result); })
})
``` ```
## Response ## Response
@ -68,12 +66,12 @@ TiktokStalk(username)
region: string region: string
} }
statistics: { statistics: {
play_count: number playCount: number
download_count: number downloadCount: number
share_count: number shareCount: number
comment_count: number commentCount: number
like_count: number likeCount: number
favourite_count: number favoriteCount: number
} }
video?: string[] video?: string[]
images?: string[] images?: string[]
@ -107,3 +105,8 @@ TiktokStalk(username)
} }
} }
``` ```
### Collaborators
- [Nugraizy](https://github.com/nugraizy)
- [Aqul](https://github.om/zennn08)

View File

@ -1,6 +1,6 @@
{ {
"name": "@tobyg74/tiktok-api-dl", "name": "@tobyg74/tiktok-api-dl",
"version": "1.0.4", "version": "1.0.2-new",
"description": "Scrapper for download Video, Image, Music from Tiktok", "description": "Scrapper for download Video, Image, Music from Tiktok",
"main": "lib/index.js", "main": "lib/index.js",
"types": "lib/index.d.ts", "types": "lib/index.d.ts",
@ -21,7 +21,8 @@
], ],
"author": "Tobz", "author": "Tobz",
"contributors": [ "contributors": [
"aqulzz" "aqulzz",
"nugraizy"
], ],
"license": "ISC", "license": "ISC",
"bugs": { "bugs": {

View File

@ -4,7 +4,7 @@ export type DLResult = {
result?: { result?: {
type: "video" | "image" type: "video" | "image"
id: string id: string
create_time: number createTime: number
description: string description: string
author: { author: {
username: string username: string
@ -14,12 +14,12 @@ export type DLResult = {
region: string region: string
} }
statistics: { statistics: {
play_count: number playCount: number
download_count: number downloadCount: number
share_count: number shareCount: number
comment_count: number commentCount: number
like_count: number likeCount: number
favourite_count: number favoriteCount: number
} }
video?: string[] video?: string[]
images?: string[] images?: string[]

View File

@ -15,7 +15,7 @@ export const TiktokDL = (url: string): Promise<DLResult> =>
const { responseUrl } = request.res const { responseUrl } = request.res
let ID = responseUrl.match(/\d{17,21}/g) let ID = responseUrl.match(/\d{17,21}/g)
if (ID === null) if (ID === null)
return reject({ return resolve({
status: "error", status: "error",
message: "Failed to fetch tiktok url. Make sure your tiktok url is correct!" message: "Failed to fetch tiktok url. Make sure your tiktok url is correct!"
}) })
@ -30,12 +30,12 @@ export const TiktokDL = (url: string): Promise<DLResult> =>
message: "Failed to find tiktok data. Make sure your tiktok url is correct!" message: "Failed to find tiktok data. Make sure your tiktok url is correct!"
}) })
const statistics = { const statistics = {
play_count: content.statistics.play_count, playCount: content.statistics.play_count,
download_count: content.statistics.download_count, downloadCount: content.statistics.download_count,
share_count: content.statistics.share_count, shareCount: content.statistics.share_count,
comment_count: content.statistics.comment_count, commentCount: content.statistics.comment_count,
like_count: content.statistics.digg_count, likeCount: content.statistics.digg_count,
favourite_count: content.statistics.collect_count favoriteCount: content.statistics.collect_count
} }
const author = { const author = {
username: content.author.unique_id, username: content.author.unique_id,
@ -50,7 +50,7 @@ export const TiktokDL = (url: string): Promise<DLResult> =>
result: { result: {
type: "image", type: "image",
id: content.aweme_id, id: content.aweme_id,
create_time: content.create_time, createTime: content.create_time,
description: content.desc, description: content.desc,
author, author,
statistics, statistics,
@ -64,7 +64,7 @@ export const TiktokDL = (url: string): Promise<DLResult> =>
result: { result: {
type: "video", type: "video",
id: content.aweme_id, id: content.aweme_id,
create_time: content.create_time, createTime: content.create_time,
description: content.desc, description: content.desc,
author, author,
statistics, statistics,