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
- Used to download videos, images, music from TikTok
- No login or password are required
- Used to download videos, images, music from TikTok
- No login or password are required
## Installation
- @tobyg74/tiktok-api-dl requires Node.js v10+ to run.
- @tobyg74/tiktok-api-dl requires Node.js v10+ to run.
### Install from NPM
@ -24,27 +24,25 @@ yarn add @tobyg74/tiktok-api-dl
### Tiktok Downloader
```js
const { TiktokDL } = require("@tobyg74/tiktok-api-dl");
const { TiktokDL } = require("@tobyg74/tiktok-api-dl")
const tiktok_url = "https://vt.tiktok.com/ZS84BnrU9"
TiktokDL(tiktok_url)
.then((result) => {
console.log(result);
})
TiktokDL(tiktok_url).then((result) => {
console.log(result)
})
```
### Tiktok Profile
```js
const { TiktokStalk } = require("@tobyg74/tiktok-api-dl");
const { TiktokStalk } = require("@tobyg74/tiktok-api-dl")
const username = "tobz2k19"
TiktokStalk(username)
.then((result) => {
console.log(result);
})
TiktokStalk(username).then((result) => {
console.log(result)
})
```
## Response
@ -68,12 +66,12 @@ TiktokStalk(username)
region: string
}
statistics: {
play_count: number
download_count: number
share_count: number
comment_count: number
like_count: number
favourite_count: number
playCount: number
downloadCount: number
shareCount: number
commentCount: number
likeCount: number
favoriteCount: number
}
video?: 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",
"version": "1.0.4",
"version": "1.0.2-new",
"description": "Scrapper for download Video, Image, Music from Tiktok",
"main": "lib/index.js",
"types": "lib/index.d.ts",
@ -21,7 +21,8 @@
],
"author": "Tobz",
"contributors": [
"aqulzz"
"aqulzz",
"nugraizy"
],
"license": "ISC",
"bugs": {

View File

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

View File

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