-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
35 lines (26 loc) · 1.01 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from flask import Flask, render_template, request, flash, redirect
from download_video import download_video, delete_mp4_audio_files
app = Flask(__name__)
app.config["SECRET_KEY"] = "hello"
@app.route('/', methods=["GET", "POST"])
def index():
if request.method == "POST":
link = request.form.get("link")
file_type = request.form.get("file_type")
if not link or not file_type:
flash("Please fill all fields !", category="error")
return redirect("/")
result = download_video(link, file_type)
if not result:
flash("Error with the link !", category="error")
return redirect("/")
flash("Video downloaded !", category="success")
return redirect("/")
return render_template('index.html')
@app.route('/delete-mp4', methods=["POST"])
def method_name():
delete_mp4_audio_files()
flash("OK", category="success")
return redirect("/")
if __name__ == '__main__':
app.run(host='127.0.0.1', port=5000, debug=True)