mirror of
https://github.com/ReviveMii/revivetube
synced 2025-09-04 04:20:59 +02:00
switching invidious instance
This commit is contained in:
parent
fd2b77ac3f
commit
3b4f9b7e3c
@ -25,7 +25,7 @@ from threading import Thread
|
|||||||
import requests
|
import requests
|
||||||
import yt_dlp
|
import yt_dlp
|
||||||
from flask import Flask, request, render_template_string, send_file, Response, abort, jsonify
|
from flask import Flask, request, render_template_string, send_file, Response, abort, jsonify
|
||||||
|
import json
|
||||||
import helper
|
import helper
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
@ -166,6 +166,16 @@ def switch_wii():
|
|||||||
return "Can't start DEBUG Mode.", 500
|
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"])
|
@app.route("/switch_n", methods=["GET"])
|
||||||
def switch_n():
|
def switch_n():
|
||||||
video_id = request.args.get("video_id")
|
video_id = request.args.get("video_id")
|
||||||
@ -184,13 +194,14 @@ def switch_n():
|
|||||||
return "Can't start DEBUG Mode.", 500
|
return "Can't start DEBUG Mode.", 500
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@app.route("/", methods=["GET"])
|
@app.route("/", methods=["GET"])
|
||||||
def index():
|
def index_wiitv():
|
||||||
query = request.args.get("query")
|
query = request.args.get("query")
|
||||||
results = None
|
results = None
|
||||||
|
|
||||||
if query:
|
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:
|
try:
|
||||||
data = response.json()
|
data = response.json()
|
||||||
except ValueError:
|
except ValueError:
|
||||||
@ -215,7 +226,6 @@ def index():
|
|||||||
|
|
||||||
return render_template_string(INDEX_TEMPLATE, results=results)
|
return render_template_string(INDEX_TEMPLATE, results=results)
|
||||||
|
|
||||||
|
|
||||||
@app.route("/watch", methods=["GET"])
|
@app.route("/watch", methods=["GET"])
|
||||||
def watch():
|
def watch():
|
||||||
video_id = request.args.get("video_id")
|
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")
|
temp_video_path = os.path.join(temp_dir, f"{video_id}.%(ext)s")
|
||||||
command = [
|
command = [
|
||||||
"yt-dlp",
|
"yt-dlp",
|
||||||
"-f worstvideo+worstaudio",
|
"-f", "worstvideo+worstaudio",
|
||||||
"--proxy", "http://localhost:4000",
|
"--proxy", "http://localhost:4000",
|
||||||
"-o", temp_video_path,
|
"-o", temp_video_path,
|
||||||
f"https://m.youtube.com/watch?v={video_id}"
|
f"https://m.youtube.com/watch?v={video_id}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user