Skip to main content

youtube-comment-downloader

Simple script for downloading Youtube comments without using the Youtube API. The output is in line delimited JSON.

Installation

Preferably inside a python virtual environment install this package via:

pip install youtube-comment-downloader

Or directly from the GitHub repository:

pip install https://github.com/egbertbouman/youtube-comment-downloader/archive/master.zip

Usage as command-line interface

$ youtube-comment-downloader --help
usage: youtube-comment-downloader [--help] [--youtubeid YOUTUBEID] [--url URL] [--output OUTPUT] [--format {jsonl,json,csv}] [--limit LIMIT] [--language LANGUAGE] [--sort SORT]

Download Youtube comments without using the Youtube API

options:
  --help, -h                                      Show this help message and exit
  --youtubeid YOUTUBEID, -y YOUTUBEID             ID of Youtube video for which to download the comments
  --url URL, -u URL                               Youtube URL for which to download the comments
  --output OUTPUT, -o OUTPUT                      Output filename (optional, defaults to video_id.ext)
  --format {jsonl,json,csv}, -f {jsonl,json,csv}  Output format: line delimited JSON (jsonl), indented JSON (json), or CSV (csv). Defaults to jsonl
  --limit LIMIT, -l LIMIT                         Limit the number of comments
  --language LANGUAGE, -a LANGUAGE                Language for Youtube generated text (e.g. en)
  --sort SORT, -s SORT                            Whether to download popular (0) or recent comments (1). Defaults to 1

For example (automatically saves to ScMzIvxBSi4.jsonl):

youtube-comment-downloader --url https://www.youtube.com/watch?v=ScMzIvxBSi4

or using a custom filename and/or format (e.g., CSV):

youtube-comment-downloader --youtubeid ScMzIvxBSi4 --output comments.csv --format csv

For Youtube IDs starting with - (dash) you will need to run the script with: -y=idwithdash or --youtubeid=idwithdash

Usage as library

You can also use this script as a library. For instance, if you want to print out the 10 most popular comments for a particular Youtube video you can do the following:

from itertools import islice
from youtube_comment_downloader import *
downloader = YoutubeCommentDownloader()
comments = downloader.get_comments_from_url('https://www.youtube.com/watch?v=ScMzIvxBSi4', sort_by=SORT_BY_POPULAR)
for comment in islice(comments, 10):
    print(comment)

Download files

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

Source Distribution

youtube_comment_downloader-0.1.82.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

youtube_comment_downloader-0.1.82-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file youtube_comment_downloader-0.1.82.tar.gz.

File metadata

File hashes

Hashes for youtube_comment_downloader-0.1.82.tar.gz
Algorithm Hash digest
SHA256 6304df9e37c87c20e2eaa46d789d556a54a0ad954a1224fa346f7f981d5ef25e
MD5 d110a93bf5f9be5cb7462e80f1649077
BLAKE2b-256 61915c1c28dff4e7bda1eb9094b45327e0706b68addab9803dec672534bee141

See more details on using hashes here.

File details

Details for the file youtube_comment_downloader-0.1.82-py3-none-any.whl.

File metadata

File hashes

Hashes for youtube_comment_downloader-0.1.82-py3-none-any.whl
Algorithm Hash digest
SHA256 b087fa8648d400fcb4b162477a5155b3fcaf7fd70a0dec9c8ce47fc5c985d82c
MD5 cdf525bf161b69e485d376c2c1461267
BLAKE2b-256 ed5f19d52705e9657e945cc02d80295b3afc49b150604cdc5b8d224573290ce8

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.83

2 files

This release

0.1.82 This release

2 files

0.1.78

2 files

0.1.76

2 files

0.1.75

2 files

0.1.74

2 files

0.1.73

2 files

0.1.72

2 files

0.1.70

2 files

0.1.68

2 files

0.1.67

2 files

0.1.65

2 files

0.1.63

2 files

0.1.61

2 files

0.1.60

2 files

0.1.59

2 files

0.1.54

1 file

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page