Online Video Downloader

from flask import Flask, render_template, request, send_file from pytube import YouTube import os # Initialize Flask app app = Flask(__name__) # Create a directory for storing downloads temp_folder = "downloads" if not os.path.exists(temp_folder): os.makedirs(temp_folder) @app.route('/') def index(): return ''' YouTube Video Downloader

YouTube Video Downloader

''' @app.route('/download', methods=['POST']) def download(): url = request.form['url'] try: yt = YouTube(url) stream = yt.streams.get_highest_resolution() file_path = stream.download(output_path=temp_folder) return send_file(file_path, as_attachment=True) except Exception as e: return f"Error: {str(e)}" if __name__ == '__main__': app.run(host='0.0.0.0', port=5000, debug=True)

Comments

Popular Posts

Class 7 Sanskrit Chapter 8 Translation in Hindi || त्रिवर्णः ध्वजः ||

NCERT Solutions for Class 10 Maths Chapter 5 Arithmetic Progressions Ex 5.3