DmitrMakeev commited on
Commit
c535987
·
verified ·
1 Parent(s): 5af79c7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -1
app.py CHANGED
@@ -72,7 +72,27 @@ def up_fa():
72
 
73
 
74
 
75
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
76
 
77
 
78
 
 
72
 
73
 
74
 
75
+ def get_video_url(video_url):
76
+ ydl_opts = {
77
+ 'format': 'best', # Выбирает лучшее качество
78
+ 'quiet': True, # Не выводить информацию в консоль
79
+ }
80
+
81
+ with yt_dlp.YoutubeDL(ydl_opts) as ydl:
82
+ info_dict = ydl.extract_info(video_url, download=False)
83
+ video_url = info_dict.get('url', None)
84
+
85
+ return video_url
86
+
87
+ @app.route('/tutub')
88
+ def index_tutub():
89
+ return render_template('tutub.html')
90
+
91
+ @app.route('/play', methods=['POST'])
92
+ def play():
93
+ video_url = request.form['video_url']
94
+ stream_url = get_video_url(video_url)
95
+ return render_template('player.html', stream_url=stream_url)
96
 
97
 
98