From 3b4f9b7e3ceaf19f676a39dd550502f08aac94f8 Mon Sep 17 00:00:00 2001 From: TheErrorExe <161362055+TheErrorExe@users.noreply.github.com> Date: Wed, 29 Jan 2025 17:25:03 +0100 Subject: [PATCH] switching invidious instance --- revivetube.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/revivetube.py b/revivetube.py index 31a674e..2e7bd11 100644 --- a/revivetube.py +++ b/revivetube.py @@ -25,7 +25,7 @@ from threading import Thread import requests import yt_dlp from flask import Flask, request, render_template_string, send_file, Response, abort, jsonify - +import json import helper app = Flask(__name__) @@ -166,6 +166,16 @@ def switch_wii(): return "Can't start DEBUG Mode.", 500 +@app.route('/test.swf') +def download_file(): + return send_file( + './test.swf', + mimetype='application/x-shockwave-flash', + as_attachment=True, # Optional, wenn du die Datei als Anhang senden möchtest + download_name='test.swf' # Optional, Name der Datei, die der Benutzer herunterladen wird + ) + + @app.route("/switch_n", methods=["GET"]) def switch_n(): video_id = request.args.get("video_id") @@ -184,13 +194,14 @@ def switch_n(): return "Can't start DEBUG Mode.", 500 + @app.route("/", methods=["GET"]) -def index(): +def index_wiitv(): query = request.args.get("query") results = None if query: - response = requests.get(f"https://y.com.sb/api/v1/search?q={query}", timeout=3) + response = requests.get(f"https://invidious.materialio.us/api/v1/search?q={query}", timeout=3) try: data = response.json() except ValueError: @@ -215,7 +226,6 @@ def index(): return render_template_string(INDEX_TEMPLATE, results=results) - @app.route("/watch", methods=["GET"]) def watch(): video_id = request.args.get("video_id") @@ -301,7 +311,7 @@ def process_video(video_id): temp_video_path = os.path.join(temp_dir, f"{video_id}.%(ext)s") command = [ "yt-dlp", - "-f worstvideo+worstaudio", + "-f", "worstvideo+worstaudio", "--proxy", "http://localhost:4000", "-o", temp_video_path, f"https://m.youtube.com/watch?v={video_id}"