Youtube Video Download Using Python
Youtube Video Download Using Python
Submitted in partial fulfillment of the requirements for the award of the degree of
Submitted By
NIRMALKUMAR G
This is to certify that the project work entitled “YOUTUBE VIDEO DOWNLOADER”
submitted to Government Arts College (Autonomous), Salem-7. in partial fulfillment requirements
for the award of degree of BACHELOR OF COMPUTER APPLICATIONS is a record of
project work done by [NIRMALKUMAR G ], (Register No : 20UCA228212) between March
2023 under my supervision and guidance.
Place : Salem-7
I here by declare that the mini project work entitled “YOUTUBE VIDEO
DOWNLOADER” submitted to Government Arts College (Autonomous), Salem-7 in partial
fulfillment of the requirements for the award of degree of BACHELOR OF COMPUTER
APPLICATIONS is a record of original work done by me under the supervision and guidance
of Mrs. D.DURGA, MCA, Guest Lecturer in Department of Computer Applications,
Government Arts College (Autonomous), Salem-7.
(NIRMALKUMAR G)
REGISTER NUMBER:
20UCA228212
Date:
At the outset, I would like to thank and honor God who gave me the wisdom and
knowledge to complete this project.
I would like to express my gratitude and sincere thanks to my guide of Mrs. D. DURGA,
MCA, guest lecture, Department of Computer Application, Government Arts College
(Autonomous), Salem-7 for her source of guidance and suggestions throughout the project.
I express my sincere thanks to all other staff members of computer application department
for this supporting help.
In order to form a clear sketch of this project, here's a brief introduction of the
features and scope of YouTube Video Downloader. This project consists of three modules which are
inter-linked to each other. Each of the above modules has certain specific task to perform. Tkinter is
the standard GUI library for Python. Python when combined with Tkinter provides a fast and easy way
to create GUI applications. Tkinter provides a powerful object- oriented interface to the Tk GUI toolkit.
Tkinter provides various controls, such as buttons, labels and text boxes used in a GUI application.
These controls are commonly called widgets.Pytube library makes the video downloading very easy.
Create the object of the YouTube module by passing the link as the parameter. Then, get the
appropriate extension and resolution of the video. You can set the name of the file as your convenience,
in another case original name will be kept. After that, download the file using the download function
which has one parameter which is the location where to download the file. Python, this task is very
easy. Few lines of code will download the video from YouTube for you.
Front-End: PYTHON
Back-End: PYTHON
OBJECTIVE:
Online YouTube Video Downloaders: These are web-based tools that allow users to
download YouTube videos by simply pasting the video URL into the download box. Some popular
examples of online YouTube video downloaders include Y2Mate, Keep Vid , and Clip Converter.
Browser Extensions: There are various browser extensions available for Google Chrome, Mozilla
Firefox, and other web browsers that allow users to download YouTube videos with ease. Some
popular extensions include Video Download Helper and Fastest Tube. Desktop Software: There are
several desktop software options available that allow users to download YouTube videos to their
computer. Some popular software include 4K Video Downloader, Free YouTube Downloader, and
WinX YouTube Downloader.
1. Quality Loss.
2. Malware and Viruses.
3. Unreliable.
4. Limited Compatibility.
➢ Platform : Windows10
➢ Processor : AMD PRO A4-350B R4, 5 COMPUTE CORES2C +
3G
➢ CPU Speed : 2.50 GHz
➢ RAM : 4 GB
➢ Hard Disk : 210 GB
2.3.3 SOFTWARE DESCRIPTION
Python is a popular programming language. It was created by Guido van Rossum. and released in
1991.Python was designed for readability, and has some similarities to the English language with
influence from mathematics. Python uses new lines to complete a command, as opposed to other
programming languages which often use semicolons or parentheses. Python relies on indentation,
using whitespace, to define scope; such as the scope of loops. functions and classes. Other
programming languages often use curly-brackets for this purpose.
• Python works on different platforms (Windows, Mac, Linux, Raspberry Pi, etc).
• Python has syntax that allows developers to write programs with fewer lines than some other
programming languages.
• Python runs on an interpreter system, meaning that code can be executed as soon as it is
written. This means thatprototyping can be very quick.
• Python can be treated in a procedural way, an object- oriented way or a functional way.
FEATURES OF PYTHON:
Easy to Learn and Use: Python has a simple syntax and structure that makes it easy to learn and use,
even for beginners.
Interpreted: Python is an interpreted language, which means that it can execute code directly without
the need for compilation. This makes it easier to test and debug code.
Multi-Platform Support: Python code can be run on a wide range of platforms, including Windows,
Linux, and macOS.
Large Standard Library: Python comes with a large standard library that includes modules for a wide
range of applications, from web development to scientific computing.
Third-Party Libraries and Frameworks: Python has a large and active community of developers who
contribute to open-source libraries and frameworks, making it easy to find resources and support for building
and maintaining Python applications.
SYSTEM DESIGN AND
DEVELOPMENT
3.1 SYSTEM DESIGN AND DEVELOPMENT
3.1 DATA FLOW DIAGRAM
START
Extract video ID
END
3.2 MODULE DESCRIPTION
The project having two categories there are
1. File
1. Downloader
2. Mode
3. Help
4. Exit
File
A file description refers to a summary or a detailed explanation of the content, purpose, and structure of
a file. It is often used to provide context and help users understand the contents
Downloader
A video downloader is a type of downloader software that is specifically designed to download video
content from websites
Mode
Light mode and dark mode are two different display modes available in software applications and
devices that allow users to switch between light and dark color schemes.
Help
Help is a type of assistance or support provided to individuals who are in need of guidance, information,
or instruction.
Exit
Exit is a command or action that allows a user to close or terminate a program, application, or system.
3.3 SYSTEM DESIGN
Definition
The most creative and challenging face of the system development is System Design. It
provides the understanding and procedural details necessary for the logical and physical stages of
development. In designing a new system, the system analyst must have a clear understanding of
the objectives, which the design is aiming to fulfill. The first step is to determine how the output
is to be produced and in what format. Second, input data and master files have to be designed to
meet the requirements of the proposed output. The operational phases are handled through program
construction and testing.
In this software, importance is given to develop Graphical User Interface (GUI), which is
an important factor in developing efficient and user friendly software. For inputting user data,
attractive forms are designed. User can also select the desired options from the menu, which
provides all possible facilities. Also the important input format is designed in such a way that
accidental errors are avoided. The user has to input only just the minimum data required, which
also helps in avoiding the errors that the users may make. Accurate designing of the input format
is very important in developing efficient software. The goal of input design is to make entry as
easy, logical and free from errors.
ABOUT:
Light mode:
Gathering URL:
File Directory:
Video Fetching:
Path setting:
Downloader:
Exit:
3.6 Code Design
Asgi.py
"""
ASGI config for djangoProject project.
import os
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'djangoProject.settings')
application = get_asgi_application()
settug.py
"""
Django settings for djangoProject project.
ALLOWED_HOSTS = ['*']
# Application definition
INSTALLED_APPS = [
'ytdl',
'crispy_forms',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'whitenoise.middleware.WhiteNoiseMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
]
ROOT_URLCONF = 'djangoProject.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [BASE_DIR / 'templates']
,
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'djangoProject.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'test',
}
}
# Password validation
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
},
]
# Internationalization
# https://docs.djangoproject.com/en/3.1/topics/i18n/
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static_serve', 'static_root')
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'static_serve', 'media_root')
CRISPY_TEMPLATE_PACK = 'bootstrap4'
# CORS_REPLACE_HTTPS_REFERER = False
# HOST_SCHEME = "http://"
# SECURE_PROXY_SSL_HEADER = None
# SECURE_SSL_REDIRECT = False
# SESSION_COOKIE_SECURE = False
# CSRF_COOKIE_SECURE = False
# SECURE_HSTS_SECONDS = None
# SECURE_HSTS_INCLUDE_SUBDOMAINS = False
# SECURE_FRAME_DENY = False
URL.py
"""djangoProject URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from ytdl import views
urlpatterns = [
path('', views.download_video),
]
Wagi.py
"""
WSGI config for djangoProject project.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'djangoProject.settings')
application = get_wsgi_application()
Manage.py
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'djangoProject.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()
VIEW.PY
from django.shortcuts import render
def download_video(request):
global context
form = DownloadForm(request.POST or None)
if form.is_valid():
video_url = form.cleaned_data.get("url")
regex = r'^(http(s)?:\/\/)?((w){3}.)?youtu(be|.be)?(\.com)?\/.+'
if not re.match(regex,video_url):
return HttpResponse('Enter correct url.')
ydl_opts = {}
try:
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
meta = ydl.extract_info(
video_url, download=False)
video_audio_streams = []
for m in meta['formats']:
file_size = m['filesize']
if file_size is not None:
file_size = f'{round(int(file_size) / 1000000,2)} mb'
resolution = 'Audio'
if m['height'] is not None:
resolution = f"{m['height']}x{m['width']}"
video_audio_streams.append({
'resolution': resolution,
'extension': m['ext'],
'file_size': file_size,
'video_url': m['url']
})
video_audio_streams = video_audio_streams[::-1]
context = {
'form': form,
'title': meta.get('title', None),
'streams': video_audio_streams,
'description': meta.get('description'),
'likes': f'{int(meta.get("like_count", 0)):,}',
'dislikes': f'{int(meta.get("dislike_count", 0)):,}',
'thumb': meta.get('thumbnails')[3]['url'],
'duration': round(int(meta.get('duration', 1))/60, 2),
'views': f'{int(meta.get("view_count")):,}'
}
return render(request, 'home.html', context)
except Exception as error:
return HttpResponse(error.args[0])
return render(request, 'home.html', {'form': form})
TESTING AND IMPLEMENTATION
4. TESTING AND IMPLEMENTATION
System testing is the state of implementation, which is aimed at ensuring that the System
Works accurate and efficient as expect before, live operation, commences. It certifies that the
whole set of programs hang together system testing requires a test plan, That consist f several key
activities and step for run program, string, system and user acceptance testing. the implementation
newly design package is important in adapting a successful new system
Testing phase development phase that validates the code against the functional
specification. testing is a vital the achievement the system goals the objective testing is to discover
errors, to fulfill this objective a series of test step such as the unit test , integration , validation and
system test where planned and executed.
UNIT TESTING
Unit testing are called module testing. The following modules have been tested
Following modules have been integrated for evaluating the efficiency of interface
The acceptance is the final stage of the user the various possibilities of the data are entered and
the result are tested.
VAILIDATION TESTING
Implementation is the final and important phase, the most critical stage in achieving a
successful new system and giving the user confidence. That the new system will work be effective
. The system can be implemented only after through testing is done and if it found to working
according to the specification
CONCLUSION
5. CONCLUSION
The project is an attempt to develop a system that can be used computerization of activities in the
company . Since these activities are tedious process lot of effort, more care has taken for the system
development the requirements a suitable database is created maximum effort were taken to avoid
duplication in data entry and data storage various report generated by this system
The major advantage of the system is fast accurate information retrieval minimization of clerical
work, easy and efficient data storage and report generation
A features that is required for the YOUTUBE VIDEO DOWNLOADER has been finished
successfully.
6. FUTURE ENHANCEMENTS
7.BIBLIOGRAPHY
7.2.1.1 https://www.tutorialspoint.com
7.2.1.2 https://www.w3schools.coM
7.2.1.3 https://www.youtube.com
7.2.1.4 www.visuastudio.com