# render HTML page return render(request, 'index.html', )Ĥ/ To define how to display it to the users, we will need a HTML file.įirst, create a 'templates' folder inside 'YTVapp'. # check thod is post or not if thod = 'POST': We need to import YouTube function from pytube. Create a function that receives the video link and download video from that link. We need to add our app in INSTALLED_APPS list in the settings.py INSTALLED_APPS = [ģ/ Go to views.py.
It will create a project named 'YTVdownloader' $ django- admin startproject YTVdownloaderĢ/ Let's create the video downloader application in our project. To create the project run the following command. $ pip install djangoġ/ It is time to create our project. We can now install the libraries in the env. (This project is done on Windows machine)
To install the libraries in separate folder, create a virtual environment. Built by experienced developers, it takes care of much of the hassle of web development, so you can focus on writing your app without needing to reinvent the wheel. 'pytube' ( pytube.io/en/latest) is a lightweight, Pythonic, dependency-free, library (and command-line utility) for downloading YouTube Videos.ĭjango: Django ( ) is a high-level Python web framework that encourages rapid development and clean, pragmatic design. We can do this in few lines of Python code, basic HTML and Django. This tutorial will show you how to create a simple application that downloads YouTube videos.