This commit is contained in:
vchikalkin 2025-08-13 17:55:47 +03:00
commit a941b7ed36
10 changed files with 7369 additions and 0 deletions

38
.gitignore vendored Normal file
View File

@ -0,0 +1,38 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# Dependencies
node_modules
.pnp
.pnp.js
# Local env files
.env
.env.local
.env.development.local
.env.test.local
.env.production.local
# Testing
coverage
# Turbo
.turbo
# Vercel
.vercel
# Build Outputs
.next/
out/
build
dist
# Debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Misc
.DS_Store
*.pem

17
.prettierrc Normal file
View File

@ -0,0 +1,17 @@
{
"arrowParens": "always",
"bracketSameLine": false,
"bracketSpacing": true,
"endOfLine": "auto",
"insertPragma": false,
"jsxSingleQuote": false,
"printWidth": 100,
"proseWrap": "preserve",
"quoteProps": "as-needed",
"requirePragma": false,
"semi": true,
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "all",
"useTabs": false
}

16
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,16 @@
{
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/.DS_Store": true,
"**/Thumbs.db": true,
"**/node_modules": true
},
"explorerExclude.backup": {},
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"source.fixAll.eslint": "explicit",
"source.removeUnusedImports": "explicit"
}
}

11
eslint.config.js Normal file
View File

@ -0,0 +1,11 @@
import { node } from '@vchikalkin/eslint-config-awesome';
/** @type {import("eslint").Linter.Config} */
export default [
...node,
{
rules: {
'unicorn/prevent-abbreviations': 'off',
},
},
];

29
package.json Normal file
View File

@ -0,0 +1,29 @@
{
"name": "Tiktok-downloader",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "tsup",
"dev": "dotenv -e .env.local tsx watch src/index.ts",
"start": "node dist/index.cjs"
},
"keywords": [],
"author": "",
"license": "ISC",
"packageManager": "pnpm@9.15.9+sha512.68046141893c66fad01c079231128e9afb89ef87e2691d69e4d40eee228988295fd4682181bae55b58418c3a253bde65a505ec7c5f9403ece5cc3cd37dcf2531",
"dependencies": {
"@tobyg74/tiktok-api-dl": "^1.3.4",
"@types/node": "^24.2.1",
"grammy": "^1.37.0",
"tsup": "^8.5.0",
"zod": "^4.0.17"
},
"devDependencies": {
"@vchikalkin/eslint-config-awesome": "^2.2.2",
"dotenv-cli": "^10.0.0",
"eslint": "^9.17.0",
"tsx": "^4.20.4",
"typescript": "^5.9.2"
}
}

7199
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

9
src/config/env.ts Normal file
View File

@ -0,0 +1,9 @@
/* eslint-disable n/no-process-env */
import { z } from 'zod';
export const envSchema = z.object({
BOT_TOKEN: z.string(),
BOT_URL: z.string(),
});
export const env = envSchema.parse(process.env);

5
src/index.ts Normal file
View File

@ -0,0 +1,5 @@
import Tiktok from '@tobyg74/tiktok-api-dl';
Tiktok.Downloader(url_pictures, {
version: 'v3', // "v1" | "v2" | "v3"
}).then((result) => console.log(result));

30
tsconfig.json Normal file
View File

@ -0,0 +1,30 @@
{
"$schema": "https://json.schemastore.org/tsconfig",
"compilerOptions": {
"declaration": false,
"declarationMap": false,
"esModuleInterop": true,
"incremental": false,
"isolatedModules": true,
"lib": ["es2022", "DOM", "DOM.Iterable"],
"module": "NodeNext",
"moduleDetection": "force",
"moduleResolution": "NodeNext",
"noUncheckedIndexedAccess": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"target": "ES2022",
"baseUrl": ".",
"outDir": "dist",
"alwaysStrict": true,
"strict": true,
// "moduleResolution": "Node",
// "module": "CommonJS",
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["."],
"exclude": ["dist", "build", "node_modules"]
}

15
tsup.config.js Normal file
View File

@ -0,0 +1,15 @@
import { defineConfig } from 'tsup';
export default defineConfig({
bundle: true,
clean: true,
entry: ['./src/index.ts'],
external: ['grammy', 'zod'],
format: 'cjs',
loader: { '.json': 'copy' },
minify: true,
outDir: './dist',
sourcemap: false,
splitting: false,
target: 'es2022',
});