{"id":1382,"date":"2022-09-16T05:50:05","date_gmt":"2022-09-16T05:50:05","guid":{"rendered":"https:\/\/www.webharvy.com\/blog\/?p=1382"},"modified":"2022-09-16T05:52:03","modified_gmt":"2022-09-16T05:52:03","slug":"scraping-comments-from-youtube-videos","status":"publish","type":"post","link":"https:\/\/www.webharvy.com\/blog\/scraping-comments-from-youtube-videos\/","title":{"rendered":"Web Scraping YouTube Comments"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<p>YouTube&#8217;s comments section is often more interesting than the video itself. Comments contain a wealth of information related to the video in the form of user submitted feedback and reviews. This article explains how comments can be scraped from YouTube videos. <\/p>\n\n\n\n<p>Details like profile name, comment text, number of likes  and replies etc. can be scraped from each comment displayed below a YouTube video.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Steps to follow <\/h2>\n\n\n\n<p>The video displayed below shows the steps which you need to follow to scrape comments from YouTube videos. You will need to <a href=\"https:\/\/www.webharvy.com\/download.html\">download and install WebHarvy<\/a> in your computer. WebHarvy is an easy to use visual web scraping software which can be used to scrape data from any website.<\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Scraping Comments of YouTube Videos | WebHarvy\" width=\"1200\" height=\"675\" src=\"https:\/\/www.youtube.com\/embed\/T9qK7sZdTFg?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<ul class=\"wp-block-list\"><li>First you will need to <a href=\"https:\/\/www.webharvy.com\/download.html\">download and install WebHarvy<\/a> in your computer.<\/li><li>Then load the YouTube video page within WebHarvy <\/li><li>Scroll down so that the comments are loaded and displayed<\/li><li><a href=\"https:\/\/www.webharvy.com\/tour.html\">Start Configuration<\/a><\/li><li>Click and select required data. When you click over a data item (like comment text), WebHarvy will display a <a href=\"https:\/\/www.webharvy.com\/tour1.html\">Capture window with various options<\/a>. Click the <a href=\"https:\/\/www.webharvy.com\/tour1.html#ScrapeText\">Capture Text<\/a> option to scrape the text of the item. <\/li><li>Once you have selected all required data, go to the Configuration menu tab and select <a href=\"https:\/\/www.webharvy.com\/tour3.html#JS\">Set JavaScript<\/a> under Pagination pane.<\/li><li>In the resulting window, paste the following code, select the &#8216;Load More Data&#8217; option and Apply.<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>document.getElementById('comments').scrollIntoView();\nels = document.getElementsByTagName('ytd-comment-thread-renderer');\nels&#91;els.length-1].scrollIntoView();<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\"><li>You can scrape comments from multiple YouTube videos using a single configuration. For this go to the <a href=\"https:\/\/www.webharvy.com\/tour3.html#AddURLs\">Configuration menu tab and click on the URLs <\/a>button. Paste URLs of additional videos which you need to scrape and Apply. <\/li><li>Stop Configuration<\/li><li>You may now optionally <a href=\"https:\/\/www.webharvy.com\/tour4.html\">save the configuration<\/a>.<\/li><li><a href=\"https:\/\/www.webharvy.com\/tour5.html\">Start Mine<\/a><\/li><li>Once mining is complete, you may <a href=\"https:\/\/www.webharvy.com\/tour6.html\">save the mined data to a file or to a database<\/a>.<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Have Questions? Need Help?<\/h2>\n\n\n\n<p>If you are new to WebHarvy we recommend that you refer the <a href=\"https:\/\/www.webharvy.com\/articles\/getting-started.html\">getting started guide<\/a>. <\/p>\n\n\n\n<p>If you have any questions you may <a href=\"https:\/\/www.webharvy.com\/support.html\">contact us<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Related Articles:<\/h2>\n\n\n\n<ol class=\"wp-block-list\"><li><a href=\"https:\/\/www.webharvy.com\/blog\/web-scraping-youtube-video-details\/\">Scraping YouTube Video Details<\/a><\/li><\/ol>\n","protected":false},"excerpt":{"rendered":"<p>YouTube&#8217;s comments section is often more interesting than the video itself. Comments contain a wealth of information related to the video in the form of user submitted feedback and reviews. This article explains how comments can be scraped from YouTube videos. Details like profile name, comment text, number of likes and replies etc. can be &#8230; <a title=\"Web Scraping YouTube Comments\" class=\"read-more\" href=\"https:\/\/www.webharvy.com\/blog\/scraping-comments-from-youtube-videos\/\" aria-label=\"Read more about Web Scraping YouTube Comments\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1382","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.webharvy.com\/blog\/wp-json\/wp\/v2\/posts\/1382","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webharvy.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webharvy.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webharvy.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webharvy.com\/blog\/wp-json\/wp\/v2\/comments?post=1382"}],"version-history":[{"count":6,"href":"https:\/\/www.webharvy.com\/blog\/wp-json\/wp\/v2\/posts\/1382\/revisions"}],"predecessor-version":[{"id":1390,"href":"https:\/\/www.webharvy.com\/blog\/wp-json\/wp\/v2\/posts\/1382\/revisions\/1390"}],"wp:attachment":[{"href":"https:\/\/www.webharvy.com\/blog\/wp-json\/wp\/v2\/media?parent=1382"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webharvy.com\/blog\/wp-json\/wp\/v2\/categories?post=1382"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webharvy.com\/blog\/wp-json\/wp\/v2\/tags?post=1382"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}