Skip to main content

A simple tool used to retrieve chat messages from livestreams, videos, clips and past broadcasts. No authentication needed!

Project description

Python PyPI version Downloads License Coverage

Chat Downloader is a simple tool used to retrieve chat messages from livestreams, videos, clips and past broadcasts. No authentication needed!

Installation

This tool is distributed on PyPI and can be installed with pip:

$ pip install chat-downloader

To update to the latest version, add the --upgrade flag to the above command.

Alternatively, the tool can be installed with git:

$ git clone https://github.com/xenova/chat-downloader.git
$ cd chat-downloader
$ python setup.py install

Usage

Command line

usage: chat_downloader [-h] [--version] [--start_time START_TIME]
                       [--end_time END_TIME]
                       [--message_types MESSAGE_TYPES | --message_groups MESSAGE_GROUPS]
                       [--max_attempts MAX_ATTEMPTS]
                       [--retry_timeout RETRY_TIMEOUT]
                       [--interruptible_retry [INTERRUPTIBLE_RETRY]]
                       [--max_messages MAX_MESSAGES]
                       [--inactivity_timeout INACTIVITY_TIMEOUT]
                       [--timeout TIMEOUT] [--format FORMAT]
                       [--format_file FORMAT_FILE] [--chat_type {live,top}]
                       [--ignore IGNORE]
                       [--message_receive_timeout MESSAGE_RECEIVE_TIMEOUT]
                       [--buffer_size BUFFER_SIZE] [--output OUTPUT]
                       [--overwrite [OVERWRITE]] [--sort_keys [SORT_KEYS]]
                       [--indent INDENT] [--pause_on_debug | --exit_on_debug]
                       [--logging {none,debug,info,warning,error,critical} | --testing | --verbose | --quiet]
                       [--cookies COOKIES] [--proxy PROXY]
                       url

For example, to save messages from a livestream to a JSON file, you can use:

$ chat_downloader https://www.youtube.com/watch?v=5qap5aO4i9A --output chat.json

For a description of these options, as well as advanced command line use-cases and examples, consult the Command Line Usage page.

Python

from chat_downloader import ChatDownloader

url = 'https://www.youtube.com/watch?v=5qap5aO4i9A'
chat = ChatDownloader().get_chat(url)       # create a generator
for message in chat:                        # iterate over messages
    chat.print_formatted(message)           # print the formatted message

For advanced python use-cases and examples, consult the Python Documentation.

Chat Items

Chat items/messages are parsed into JSON objects (a.k.a. dictionaries) and should follow a format similar to this:

{
    ...
    "message_id": "xxxxxxxxxx",
    "message": "actual message goes here",
    "message_type": "text_message",
    "timestamp": 1613761152565924,
    "time_in_seconds": 1234.56,
    "time_text": "20:34",
    "author": {
        "id": "UCxxxxxxxxxxxxxxxxxxxxxxx",
        "name": "username_of_sender",
        "images": [
            ...
        ],
        "badges": [
            ...
        ]
    },
    ...
}

For an extensive, documented list of included fields, consult the Chat Item Fields page.

Frequently Asked Questions

Coming soon

Issues

Found a bug or have a suggestion? File an issue here. To assist the developers in fixing the issue, please follow the issue template as closely as possible.

Contributing

If you would like to help improve the tool, you’ll find more information on contributing in our Contributing Guide.

Supported sites:

  • YouTube.com - Livestreams, past broadcasts and premieres.

  • Twitch.tv - Livestreams, past broadcasts and clips.

  • Reddit.com - Livestreams, past broadcasts

  • Facebook.com (currently in development) - Livestreams and past broadcasts.

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

chat-downloader-0.1.10.tar.gz (110.9 kB view details)

Uploaded Source

Built Distribution

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

chat_downloader-0.1.10-py2.py3-none-any.whl (80.9 kB view details)

Uploaded Python 2Python 3

File details

Details for the file chat-downloader-0.1.10.tar.gz.

File metadata

  • Download URL: chat-downloader-0.1.10.tar.gz
  • Upload date:
  • Size: 110.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for chat-downloader-0.1.10.tar.gz
Algorithm Hash digest
SHA256 b0545a8c2d4a9c7e5026e1e0f44056e4becd3c39783c0c28751b16693efd626f
MD5 7566d996cfdde4146c0f323adde59a39
BLAKE2b-256 49104ea561d3b8aa6661f4eded3a887cfef1dc827591f1d5d7ea2c0e1f86ba8c

See more details on using hashes here.

File details

Details for the file chat_downloader-0.1.10-py2.py3-none-any.whl.

File metadata

  • Download URL: chat_downloader-0.1.10-py2.py3-none-any.whl
  • Upload date:
  • Size: 80.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6

File hashes

Hashes for chat_downloader-0.1.10-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a3d3ae1a992edf4241b4ba57f492ee23fe46a7599b8db8da69ecb08a93bea1f3
MD5 2f9d5c32bb1f3ad1e67eb33778d3617c
BLAKE2b-256 0e6e1436d3ea40b02949a2e0090ca0f384656fc98d4bd8e8e9bcb028212cb198

See more details on using hashes here.

Supported by

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