feat: add dotenv support for environment configuration and update cookies handling
This commit is contained in:
parent
fcad34cd93
commit
18c5a0184e
5
.env.example
Normal file
5
.env.example
Normal file
@ -0,0 +1,5 @@
|
||||
# Example .env for tubapi-node
|
||||
# Path to node binary used by yt-dlp JS runtime fallback
|
||||
NODE_PATH=/usr/bin/node
|
||||
# Port for the API server
|
||||
PORT=8282
|
||||
13
cookies.txt
13
cookies.txt
@ -7,13 +7,12 @@
|
||||
.youtube.com TRUE / TRUE 1789709402 __Secure-1PSIDTS sidts-CjQBBj1CYiRV7UVF_NUth-Gfo95O96s1Cs-1NuMHMJPiT7n_HlJPWYuFOcN1oT5CG8TLiIaHEAA
|
||||
.youtube.com TRUE / TRUE 1789709402 __Secure-3PSIDTS sidts-CjQBBj1CYiRV7UVF_NUth-Gfo95O96s1Cs-1NuMHMJPiT7n_HlJPWYuFOcN1oT5CG8TLiIaHEAA
|
||||
.youtube.com TRUE / TRUE 1805695434 __Secure-3PSIDCC AKEyXzXoh06KK4RlJVNA9_d9X7nQTUeTyjck38lMhpTSlrPdPM4WJmXwY1Dwcb04bGAEFsfBOA
|
||||
.youtube.com TRUE / TRUE 1789717979 VISITOR_INFO1_LIVE tao8KQuuHoU
|
||||
.youtube.com TRUE / TRUE 1789717979 VISITOR_PRIVACY_METADATA CgJNWBIEGgAgGQ%3D%3D
|
||||
.youtube.com TRUE / TRUE 1789749904 VISITOR_INFO1_LIVE tao8KQuuHoU
|
||||
.youtube.com TRUE / TRUE 1789749904 VISITOR_PRIVACY_METADATA CgJNWBIEGgAgGQ%3D%3D
|
||||
.youtube.com TRUE / TRUE 1789702583 __Secure-YNID 16.YT=vu9HeA2iqnPH-ADjGUgMWcecXN8tAYkSOswDaAH2YJDti3-DJqQNwyMyan0-6fTAnS8DJXEOTQjcx9WcOO7eoZXbiTQIyc06NpWwnZgBks8y8hM1zLBOwLJgUDID6rMU__elM4SZzXDER7cRrHpK8JBH-BwHmrTr9SLuwxjQy07uDTxhr43IC-Xkc4qgUc0sJIHVDChce5CjKSfYK9FXCOoWW1gzxZ2YUJRrKt5UR5rLaLD8wUvEgesYFEen8bNP1FvBE4TGLl_l7N9EiZFvnI7cwIC-nz2jdlYb-AegSCtZzDTin0Jp0036TozvB6nTIYS-aNTwIw2Fo1F6w8vRhQ
|
||||
.youtube.com TRUE / TRUE 1789702583 __Secure-ROLLOUT_TOKEN CJvoma2RkvyUPhC78ITB9aqTAxjHlq76ybKTAw%3D%3D
|
||||
.youtube.com TRUE / TRUE 1837237978 __Secure-YT_TVFAS t=492746&s=2
|
||||
.youtube.com TRUE / TRUE 1789717978 DEVICE_INFO ChxOell4T1RrME9EVXdNRGd5TXpjNU1ETXlNUT09ENq//s0GGMr9/c0G
|
||||
.youtube.com TRUE / TRUE 1774166662 GPS 1
|
||||
.youtube.com TRUE / TRUE 1837269903 __Secure-YT_TVFAS t=492746&s=2
|
||||
.youtube.com TRUE / TRUE 1789749903 DEVICE_INFO ChxOell4T1RrME9EVXdNRGd5TXpjNU1ETXlNUT09EI+5gM4GGMr9/c0G
|
||||
.youtube.com TRUE / TRUE 0 SOCS CAI
|
||||
.youtube.com TRUE / TRUE 0 YSC 7WQi0NEj8Ag
|
||||
.youtube.com TRUE /tv TRUE 1806997978 __Secure-YT_DERP CMyH7KS6Aw%3D%3D
|
||||
.youtube.com TRUE / TRUE 1774199702 GPS 1
|
||||
.youtube.com TRUE /tv TRUE 1807029903 __Secure-YT_DERP CMyH7KS6Aw%3D%3D
|
||||
|
||||
5
index.js
5
index.js
@ -1,13 +1,14 @@
|
||||
require('dotenv').config();
|
||||
const express = require('express');
|
||||
const { spawn } = require('child_process');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
const multer = require('multer');
|
||||
const app = express();
|
||||
const PORT = process.env.PORT || 8282;
|
||||
const PORT = process.env.PORT ? Number(process.env.PORT) : 8282;
|
||||
|
||||
// CONFIGURACIÓN DE RUTAS
|
||||
const NODE_PATH = '/usr/bin/node';
|
||||
const NODE_PATH = process.env.NODE_PATH || '/usr/bin/node';
|
||||
const COOKIES_FILE = path.resolve(__dirname, 'cookies.txt');
|
||||
const COOKIES_PATH = COOKIES_FILE;
|
||||
const { warmAndExportCookies, exportCookiesFromBotProfile } = require('./cookiewarmer');
|
||||
|
||||
13
package-lock.json
generated
13
package-lock.json
generated
@ -10,6 +10,7 @@
|
||||
"hasInstallScript": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"dotenv": "^16.1.4",
|
||||
"express": "^4.18.2",
|
||||
"multer": "^1.4.5-lts.1",
|
||||
"playwright": "^1.58.2",
|
||||
@ -1209,6 +1210,18 @@
|
||||
"npm": "1.2.8000 || >= 1.4.16"
|
||||
}
|
||||
},
|
||||
"node_modules/dotenv": {
|
||||
"version": "16.6.1",
|
||||
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz",
|
||||
"integrity": "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==",
|
||||
"license": "BSD-2-Clause",
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://dotenvx.com"
|
||||
}
|
||||
},
|
||||
"node_modules/dunder-proto": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
|
||||
|
||||
@ -28,6 +28,7 @@
|
||||
"dependencies": {
|
||||
"express": "^4.18.2",
|
||||
"multer": "^1.4.5-lts.1",
|
||||
"dotenv": "^16.1.4",
|
||||
"playwright": "^1.58.2",
|
||||
"playwright-extra": "^4.3.6",
|
||||
"puppeteer-extra-plugin-stealth": "^2.11.2"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user