Python 3 Web Scraping Script to Search Youtube Videos Using Keyword Using Youtube Data API V3
14 views
Jun 3, 2025
Buy the full source code of application here:
View Video Transcript
0:00
uh hello guys welcome to this video so
0:02
in this video I will show you how to
0:04
build out a video search kind of an
0:07
application inside Python using a
0:09
open-source module which actually
0:13
scrapes the YouTube videos based upon a
0:17
keyword so here you can actually search
0:19
YouTube programmatically inside Python
0:22
so let me show you the actual module
0:24
here which is a web scraping module
0:26
scrape tube so simply install this
0:29
module by executing this command so
0:31
after installing it you just need to
0:35
import this so we simply say import
0:38
scrape tube after that we will simply
0:43
call this function scrape tube dot get
0:47
search so here you can specify any
0:49
keyword on which you want to search the
0:52
YouTube videos so let's suppose I want
0:54
to search YouTube videos on programming
0:56
in double quotes we
0:58
provide so this is actually the
1:01
keyword by which you are searching so in
1:05
double quotes you paste your key uh
1:07
keyword and then we have some options
1:11
here so if you want to only
1:15
return you can put a limit here so I
1:18
only want five videos related to
1:21
programming and we can even sort this so
1:24
sort by relevance or upload date so if
1:28
you want these four options are there as
1:31
you see in the YouTube website as well
1:33
so if you want the popular videos
1:36
related to programming or if you want
1:38
relevance upload date or view count so I
1:43
want videos which have the highest
1:45
number of views so top five videos of
1:48
programming which have the highest views
1:51
so this will return this and now we can
1:53
loop
1:55
through this act this is an array here
1:58
and then we can display the
2:03
title so now what happens if I execute
2:06
this you will see it will return the top
2:07
five videos related to py uh programming
2:10
python full course for beginners then we
2:13
got C
2:15
language like this so it returns five
2:18
videos and uh you can also print out the
2:22
video
2:26
id so this will be the video
2:30
ids so it returns five video ids five
2:34
videos you can change this let's suppose
2:36
I make it 10 so this will now return 10
2:40
videos so it's a very good module guys
2:43
as you can see we are not using any sort
2:45
of API key it is communicating with the
2:47
YouTube data API in the background by
2:50
web scraping the results from
2:52
YouTube and uh this is actually a JSON
2:56
response which contains all these
2:59
properties so you can see each video has
3:03
some properties attached to it so it has
3:07
returned 10 videos so that's why we have
3:09
got this JSON response we have the video
3:11
ID we have the thumbnails we have the
3:14
title width height everything is there
3:16
so in this way guys you can build out a
3:18
very good YouTube search kind of an
3:21
application using this module in Python
3:24
to make this API so I tested this module
3:28
it works pretty well you can do this
3:31
unlimited number of time without using
3:33
any sort of API key so it's a great
3:35
module definitely install it and start
3:38
using it and thank you very much for
3:40
watching this video and also check out
3:42
my website freemediatools.com
3:45
uh which contains thousands of tools
#Online Video
#Scripting Languages
#Software
#Video Sharing