How to Scrape YouTube Comments with Python 2024

  Рет қаралды 10,537

Analytics with Adam

Analytics with Adam

Күн бұрын

Пікірлер: 71
@analyticswithadam
@analyticswithadam 8 ай бұрын
Updated Video with Replies kzbin.info/www/bejne/d2KsenyVebaIaqssi=_8-d4OpoIHpr2jJm
@Fallkhar
@Fallkhar 4 ай бұрын
Thank you, man, you really made it work for me. My initial approach was HTML parsing with beautiful soup which proved to be very difficult because not all comments are loaded and I think google limits accessing that way as well.
@analyticswithadam
@analyticswithadam 4 ай бұрын
Glad it helped!
@Fallkhar
@Fallkhar 4 ай бұрын
@@analyticswithadam Yeah, it really helped me get into the KZbin API. I've now expanded the code to get all the comments from an entire KZbin channel by using the uploads playlist.
@al-naqeep
@al-naqeep 6 күн бұрын
Can I use Python library youtube comment download
@Fallkhar
@Fallkhar 6 күн бұрын
@@al-naqeep You mean like the code I wrote?
@L_Only_Cans
@L_Only_Cans 11 ай бұрын
Great video! Do you know how much of your quota this used up or roughly how many comments you can extract per day with the current call limit quota? Thanks again!
@analyticswithadam
@analyticswithadam 11 ай бұрын
Each call is 1 . Quota is 10k per day. A million comments perhaps but haven’t tried to max it out.
@L_Only_Cans
@L_Only_Cans 11 ай бұрын
@@analyticswithadam excellent thanks
@yuxrazafar8532
@yuxrazafar8532 9 ай бұрын
I want to extract the comments from a playlist. do i have to gather all the IDs manually or I can automate it through some API?
@analyticswithadam
@analyticswithadam 9 ай бұрын
I have a video on the way to do just that.. Here is the code in advance, pulls the replys as well. github.com/analyticswithadam/Python/blob/main/Pull_all_Comments_and_Replies_for_KZbin_Playlists.ipynb
@yuxrazafar8532
@yuxrazafar8532 9 ай бұрын
Oh Thank you so much!@@analyticswithadam
@oitik
@oitik 10 ай бұрын
Great video. I have a question i am doing a research where i need to scrape comments from a live stream. How can i do that can you help? because your code cannot scrape the live comments.
@JamesDeanDesigns
@JamesDeanDesigns 10 ай бұрын
This really helped me out. Thank you
@analyticswithadam
@analyticswithadam 10 ай бұрын
Awesome 🙌
@SabineWildemann-l9q
@SabineWildemann-l9q 10 ай бұрын
Hi Adam, Thanks for this tutorial series, very helpful! If i don't have the IDs of the videos but a phrase I'd like to analyse (like "Die letzte Generation"), how can i proceed based on your code? Thanks for your time!
@analyticswithadam
@analyticswithadam 10 ай бұрын
Would this phrase be in the video title?
@SabineWildemann-l9q
@SabineWildemann-l9q 10 ай бұрын
@@analyticswithadamyes
@04mdsimps
@04mdsimps 7 ай бұрын
Really nice work. Good stuff
@vbrant2705
@vbrant2705 10 ай бұрын
thanks for the tutorial !!! btw is there any daily limit for using the API ? and also how much does the API cost ? I'm planning to build a model for sentiment analysis based from yt comments of a movie trailer. I want to use Oppenheimer trailer as the data source. The trailer has approximately 32 thousand comments.
@analyticswithadam
@analyticswithadam 10 ай бұрын
The limit is 10,000 a day per request, I think this is one request per 100 comments so you should be good but let me know if you get them all. The API is free, I show how to get setup in the comment in the description.
@vbrant2705
@vbrant2705 10 ай бұрын
@@analyticswithadam thanks for the reply. Okay so if the limit is 10.000 per day, how can i scrapped the rest of it in the next day so that the script doesn't scrapped the same 10.000 comments again? How can i modify the script for that purpose?
@analyticswithadam
@analyticswithadam 10 ай бұрын
@@vbrant2705 1 credit should pull 100 comments so I think you will be fine, if it doesn't. The pageToken=nextPageToken should store the last page token used so you can start with that Token next time
@vbrant2705
@vbrant2705 10 ай бұрын
@@analyticswithadam okay. I will try it. Thank you
@vbrant2705
@vbrant2705 9 ай бұрын
@@analyticswithadam hello. I got some news. So i've tried to do some scraping but i only got 22k instead of 32k. When i looked at my api stat, i'm only using 225 request out of 10k. Why can't i get the rest of the comments ? many thanks.
@julianebrito5788
@julianebrito5788 2 ай бұрын
Hi from Brazil, I loved the video. I would really like to know how to extract it from the KZbin chat
@robosergTV
@robosergTV 5 ай бұрын
Why would you do while 1==1 and not simply while True? Just for jokes?
@analyticswithadam
@analyticswithadam 5 ай бұрын
Its a weird one. Its an infinite loop until the Try Except block breaks you out of it. So the while loop isn't evaluating anything. Nothing is ever going to be False.
@eig-datos
@eig-datos 21 күн бұрын
You are the best, thanks soo muuchhhh
@analyticswithadam
@analyticswithadam 7 күн бұрын
Glad it helped
@HauntedRabbit-x7j
@HauntedRabbit-x7j 9 ай бұрын
Very useful video. Thank you for sharing sharing knowledge.
@omerfaruksezeerr
@omerfaruksezeerr 11 ай бұрын
hello, I just want to pull the comments on a yotube channel, how can I do this, do I need to do a separate process for each video or is this possible only for a yotube account please help me thank you very much
@analyticswithadam
@analyticswithadam 11 ай бұрын
Hi Omer, What you need to do is collect the video ids and them put them in the for loop of the code discussed at the end of the video. Two ways to do this. 1. Manually open the video and pull the codes. For example the url of this video is kzbin.info/www/bejne/ZnfXlHugfpqfo9k&lc=UgwJNvziZkqzm3m__J94AaABAg the code is after the 'v='. 2. Use the youtube API to pull all the codes. . Instructions in the url below. developers.google.com/youtube/v3/docs/videos/list
@mohamedmowena353
@mohamedmowena353 8 ай бұрын
Can u make a video in how to scrape the captions/subtitle. Thank u very much.
@zeha997
@zeha997 10 ай бұрын
Is there any way to extract comment after translating in english? I want to extract only english comments.
@analyticswithadam
@analyticswithadam 10 ай бұрын
I don’t think anything detects the language in the api but I’m sure Python has a package to classify the languages then you can filter
@analyticswithadam
@analyticswithadam 10 ай бұрын
Try this medium.com/swlh/language-classification-using-machine-learning-in-python-fa0768daea67
@BECEOOYaashuDave
@BECEOOYaashuDave 9 ай бұрын
What if i want to extract the replies as well?What should we do?
@analyticswithadam
@analyticswithadam 8 ай бұрын
Have a video coming on Tuesday that includes the replies, here is the script …github.com/analyticswithadam/Python/blob/main/Pull_all_Comments_and_Replies_for_KZbin_Playlists.ipynb
@emmanuel.alcantara
@emmanuel.alcantara 11 ай бұрын
how can I extract for example the 967 comments to a txt file?
@analyticswithadam
@analyticswithadam 11 ай бұрын
Pull the dataframe to a csv using python.. Are you using Google Colab?
@emmanuel.alcantara
@emmanuel.alcantara 11 ай бұрын
@@analyticswithadam yes
@analyticswithadam
@analyticswithadam 11 ай бұрын
@@emmanuel.alcantara First answer here. stackoverflow.com/questions/53898836/export-dataframe-as-csv-file-from-google-colab-to-google-drive
@fuadanjasmara
@fuadanjasmara 15 күн бұрын
Good video but I have a problem in dev number. How you get that?
@analyticswithadam
@analyticswithadam 15 күн бұрын
Dev number?
@fuadanjasmara
@fuadanjasmara 14 күн бұрын
@@analyticswithadam yes
@analyticswithadam
@analyticswithadam 14 күн бұрын
@@fuadanjasmara Sorry just looked at the code, Its a API Key you need for KZbin, its free but you need to go to Google Cloud to generate.Go to 1.50 of this video for a walkthrough on how to get it. kzbin.info/www/bejne/Z3zad3mYlNminLs
@analyticswithadam
@analyticswithadam 14 күн бұрын
@@fuadanjasmara Ive made a few videos on the API the first one had the instructions and I skipped on this one
@fuadanjasmara
@fuadanjasmara 14 күн бұрын
@@analyticswithadam I see. Thanks, Adam.
@christinapachaki3554
@christinapachaki3554 6 ай бұрын
great work, can someone please share with me the video that demonstrates the API KEy?
@analyticswithadam
@analyticswithadam 6 ай бұрын
Have it in the follow up video too How to Extract all KZbin Comments and Comment Replies from a Playlist kzbin.info/www/bejne/d2KsenyVebaIaqs
@joysarkar-hb4tj
@joysarkar-hb4tj 6 ай бұрын
how i get or save file of these extract comments???
@analyticswithadam
@analyticswithadam 6 ай бұрын
You can pull the dataframe out of a notebook as a CSV
@mrpepeluis950
@mrpepeluis950 6 ай бұрын
Chido one, great video!
@gsonbiswas9765
@gsonbiswas9765 11 ай бұрын
Does it extract the nested comments?
@analyticswithadam
@analyticswithadam 11 ай бұрын
It does not
@sarvarbekfozilov9829
@sarvarbekfozilov9829 9 ай бұрын
#question hi adam thank for tutorial. currently i need scrap comments from instagram and facebook how can i do that?
@analyticswithadam
@analyticswithadam 9 ай бұрын
No idea at the moment but I’ll have a look..
@damochi100
@damochi100 11 ай бұрын
does exactly what it says
@analyticswithadam
@analyticswithadam 11 ай бұрын
Sure does
@zeha997
@zeha997 10 ай бұрын
how to extract these comments in excel?
@analyticswithadam
@analyticswithadam 10 ай бұрын
If you are using Google colab If the dataframe is named something other than df change all the 'df' below to whatever its called from google.colab import files df.to_csv('df.csv', index=False) files.download('df.csv')
@zeha997
@zeha997 10 ай бұрын
@@analyticswithadam thanks
@ResearchonSihr
@ResearchonSihr Ай бұрын
@@analyticswithadam Hi, thank you for your tutorial. I'm not familiar with Google colab so how to extract the comments in a txt or csv file ? I don't really understand what you said in reply to zeha997. Can you elaborate please? Thank you in advance
@emaa786
@emaa786 4 ай бұрын
I want to ask something anyone here?
How to extract YouTube Comments Using the YouTube API
2:27
Analytics with Adam
Рет қаралды 26 М.
Бенчик, пора купаться! 🛁 #бенчик #арти #симбочка
00:34
Симбочка Пимпочка
Рет қаралды 4 МЛН
ЗНАЛИ? ТОЛЬКО ОАЭ 🤫
00:13
Сам себе сушист
Рет қаралды 3,6 МЛН
Osman Kalyoncu Sonu Üzücü Saddest Videos Dream Engine 269 #shorts
00:26
This is How I Scrape 99% of Sites
18:27
John Watson Rooney
Рет қаралды 139 М.
Web Scraping with Professional Proxy Servers in Python
32:26
NeuralNine
Рет қаралды 50 М.
Web Scraping with Python - Beautiful Soup Crash Course
1:08:23
freeCodeCamp.org
Рет қаралды 1,5 МЛН
Always Check for the Hidden API when Web Scraping
11:50
John Watson Rooney
Рет қаралды 640 М.
This Is Why Python Data Classes Are Awesome
22:19
ArjanCodes
Рет қаралды 812 М.
How to Extract Data from Twitter using Python [Tweepy API]
5:40
Analytics with Adam
Рет қаралды 72 М.
Scraping YouTube with OpenAI API (Python, ChatGPT, YouTube Transcript API)
41:55
Beautiful Soup 4 Tutorial #1 - Web Scraping With Python
17:01
Tech With Tim
Рет қаралды 483 М.
Бенчик, пора купаться! 🛁 #бенчик #арти #симбочка
00:34
Симбочка Пимпочка
Рет қаралды 4 МЛН