Great, we have successfully captured a comment request, if you click on it, you will see the actual request URL, method and the remote IP address: If you go back to the network tool, you'll see something like this: Now go to the video page and scroll down until you see some comments loaded. Notice I wrote "comment" in the filter input field, this will help us filter out the unwanted HTTP requests such as images, style and Javascript files, etc. Now in order to follow along with me, go into any YouTube video of your choice with Chrome or any other browser and right click and choose Inspect Element and go to Network section: Related: How to Extract YouTube Data in Python.īefore we get started, let's install the requirements: pip3 install requests Monitoring Network Traffic in the Browser Note: If the code of this tutorial doesn't work for you, please check out using YouTube API tutorial instead. In this tutorial, we will not only write a Python script to extract YouTube comments, but we will be experimenting with the network utility in browser's developer tools in order to capture the right comment request so that it can help us on writing the code. Being able to extract comments from the biggest video sharing website in the Internet is a handy tool, you can extract comments to perform tasks such as text classification, or you may want to extract comments of your YouTube videos to do certain tasks, the possibilities are endless.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |