diff --git a/.gitignore b/.gitignore index 148142d..2dcbfa1 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,5 @@ assets/*.mov .env .env.local .env.production -.env.development \ No newline at end of file +.env.development +cookies.txt diff --git a/app.py b/app.py index 703f435..c4b81e2 100644 --- a/app.py +++ b/app.py @@ -8,6 +8,7 @@ app = Flask(__name__) DOWNLOAD_DIR = os.path.join(os.path.dirname(__file__), "downloads") +COOKIES_FILE = os.path.join(os.path.dirname(__file__), "cookies.txt") os.makedirs(DOWNLOAD_DIR, exist_ok=True) jobs = {} @@ -18,6 +19,8 @@ def run_download(job_id, url, format_choice, format_id): out_template = os.path.join(DOWNLOAD_DIR, f"{job_id}.%(ext)s") cmd = ["yt-dlp", "--no-playlist", "-o", out_template] + if os.path.isfile(COOKIES_FILE): + cmd += ["--cookies", COOKIES_FILE] if format_choice == "audio": cmd += ["-x", "--audio-format", "mp3"] @@ -86,6 +89,8 @@ def get_info(): return jsonify({"error": "No URL provided"}), 400 cmd = ["yt-dlp", "--no-playlist", "-j", url] + if os.path.isfile(COOKIES_FILE): + cmd += ["--cookies", COOKIES_FILE] try: result = subprocess.run(cmd, capture_output=True, text=True, timeout=60) if result.returncode != 0: diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..4db70ea --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,8 @@ +services: + reclip: + build: . + ports: + - "8899:8899" + volumes: + - ./cookies.txt:/app/cookies.txt + restart: unless-stopped