Python script for scrapping YouTube video data given url of the videos.
Libraries modules:
- selenium
- pandas
!pip install selenium
#How to use.
Here is the code in query.py
file. Replace your topic (gate 2020) for which you want to extract data and specify no of videos.(here 501)
It will go to the YouTube, search for that query and extract data for the first 501 videos.
query = 'gate 2020' #enter your query for which you want to scrap videos
no_of_videos = 501 #enter number of videos you want to scrap.
Query and number of videos for which you want to scrap data.
csv file containing url, Timestamp, Title, Views, upload_date, Likes, Dislikes and Comments.
- Timestamp: Date and time at which data is extracted
Here I have extracted data for 501 videos for Query - 'gate 2020' and provided in the .csv file.
Time taken to complete and number of videos you want to scrap have positive coorelation ..:slightly_smiling_face:
Go Ahead try yourself and contribute to kaggle dataset
Connect with me: