From a3f52ff459879cb375e9879a815ac3ba843f8c81 Mon Sep 17 00:00:00 2001 From: TobyG74 Date: Sat, 8 Apr 2023 17:30:02 +0700 Subject: [PATCH] change to camelCase --- README.md | 41 ++++++++++++++++++++++------------------- package.json | 5 +++-- src/types/index.ts | 14 +++++++------- src/utils/index.ts | 18 +++++++++--------- 4 files changed, 41 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index 7fe52a7..08fa8b6 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/package.json b/package.json index 835918c..5396c9e 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/types/index.ts b/src/types/index.ts index 5742c0f..cd2de7e 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -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[] diff --git a/src/utils/index.ts b/src/utils/index.ts index 7413d95..ed88b08 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -15,7 +15,7 @@ export const TiktokDL = (url: string): Promise => 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 => 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 => 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 => result: { type: "video", id: content.aweme_id, - create_time: content.create_time, + createTime: content.create_time, description: content.desc, author, statistics,