A python library to scrape video's comments data from youtube automatically.
Project description
Youtube-Comment-Scraper-Python is a python library to fetch video comments on youtube using browser automation. It currently runs only on windows.
Example1
In this example we first import library, then we will open the video and fetch comments one time only.
from youtube_comment_scraper_python import *
youtube.open("https://www.youtube.com/watch?v=C5duQyX7Gec")
response=youtube.video_comments()
data=response['body']
#data=[{"Comment": "This planet belongs to all of us ", "UserLink": "https://www.youtube.com/channel/UCpH24tSZnFGAECI_ZCa7jJQ", "user": "
Mohd Haris", "Time": "14 hours ago", "Likes": "23"}]
Example2:- Load More Comments
In this example we first import library, then we will open the video and fetch the comments five times, as it scrolls whenever function called.
from youtube_comment_scraper_python import *
youtube.open("https://www.youtube.com/watch?v=C5duQyX7Gec")
all_data=[]
for i in range(0,5):
response=youtube.video_comments()
data=response['body']
all_data.extend(data)
#data=[{"Comment": "This planet belongs to all of us ", "UserLink": "https://www.youtube.com/channel/UCpH24tSZnFGAECI_ZCa7jJQ", "user": "
Mohd Haris", "Time": "14 hours ago", "Likes": "23"}]
This module depends on the following python modules
BotStudio
bot_studio is needed for browser automation. As soon as this library is imported in code, automated browser will open up in which video will be opend and comments will be fetched.
Complete documentation for YouTube Automation available here
Installation
pip install youtube-comment-scraper-python
Import
from youtube_comment_scraper_python import *
Login with credentials
youtube.login(username="youtube username",password="youtube password")
Login with cookies
youtube.login_cookie(cookies=list_of_cookies)
Open video link
youtube.open("video link")
Get comments
response=youtube.video_comments()
data=response['body']
Send Feedback to Developers
bot_studio.send_feedback(feedback="Need help with this ......")
Contact Us
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for youtube-comment-scraper-python-1.0.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c483a74d89901a36b255aafa13a1cf8ec96cf2fe11ed72ece574cea56fa23467 |
|
MD5 | da0bcef686ca959a99ffa2110cb8980d |
|
BLAKE2b-256 | c548b9fe6ab906b39f63e8fbf78cd0f09f41cf5f0f07782e0311210371672bef |