Skip to main content

youcos is a simple Python package for scraping YouTube videos and comments

Project description

GitHub PyPI

youcos

youcos (youtube comment scraper) is a simple Python package for scraping YouTube comments!

:four_leaf_clover: Easy YouTube v3 API Wrapper - Simply provide your YouTube v3 API Key, and youcos will take care of the rest! No additional code needed to configure API and process fetched JSON data.

:earth_asia: Diverse Language Support - Search, scrape, and save videos & comments in different languges with youcos.

:test_tube: Configurable Search Settings - Adjust search location and search method.

:chart_with_upwards_trend: Minimized Quota Usage - Scrape comments without exhausting YouTube v3 quota through the built-in Selenium module with youcos!

Demo

There are two main ways to scrape comments:

  1. Scraping video titles and comments together
from youcos import scrape_youtube

KEY = 'YOUR_YOUTUBE_V3_API_KEY'

# Call YouTube v3 API to request the first 30 videos search results for 'stocks'
# and scrape each video's top __ comments
scrape_youtube('stocks', KEY)
  1. Scraping video titles and comments separately
from youcos import scrape_videos, scrape_comments

KEY = 'YOUR_YOUTUBE_V3_API_KEY'

# Call YouTube v3 API to request the first 30 videos search results for 'stocks'
videos = scrape_videos("stocks", KEY)

# Filter videos to avoid re-scraping comments
filtered_videos = foo(videos)

# Scrape comments for filtered videos
scrape_comments(filtered_videos)

def foo(videos):
    # function to filter videos

Installation

pip install youcos

Features

The following data are saved into the csv file:

Video Data Comment Data
URL text
title author
channel name date
upload date no. of replies
no. of likes no. of upvotes
no. of dislikes -

Dependencies

Documentation

Check ___ for specific API documentation. This project was documented following the numpy docstring conventions, which are supported by common documentation tools like Sphynx while also maintaining readability.

Credits

  • Author: Seunggun Lee
  • Languages/Tools: Python3, Selenium

To Do

Functionalities

  • search based on different filters
  • selenium dependency support for all drivers
  • choose to filter comments based on relevancy & top comments
  • headless browser scraping (option)
  • maximum number of videos to scrape
  • maximum number of comments to scrape
  • method to skip video authentication

Deployment

  • use Sphynx to build documentation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

youcos-0.0.2.tar.gz (6.0 kB view hashes)

Uploaded Source

Built Distribution

youcos-0.0.2-py3-none-any.whl (7.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page