Youtube Closed Captions
Downloads the closed captions(subtitles) from Youtube videos
Requirements
Currently requires Python >= 3.12
Install
pip install youtube-closed-captions
To Use
from ytcaptions import Download
video_id = 'jNQXAC9IVRw'
download = Download()
# Language is optional and default to "en"
# YouTube uses "en","fr" not "en-US", "fr-FR"
captions = download.get_captions(video_id, 'en')
Upgrading to 1.0.0
The Python package is now ytcaptions to avoid a conflict with the unrelated ytcc package. Update from ytcc.download import Download to from ytcaptions import Download. DownloadException is also exported from ytcaptions. Imports from ytcaptions.download and ytcaptions.storage remain available. The old ytcc import is removed.
The PyPI distribution name is youtube-closed-captions, and Python 3.12 or newer is required.
Development
Install the library and test dependencies from this directory:
pip install -e . -r requirements.txt
Run Tests
Note: Functional tests do download directly from Youtube
## All tests
pytest
## Or using unittest
python -m unittest discover
## Unit tests
python -m unittest discover test/unit
## Functional tests
python -m unittest discover test/functional
Prepare a release
Build and validate the release files locally:
pip install build twine
pytest test/unit
python -m build
python -m twine check --strict dist/youtube_closed_captions-1.0.0-py3-none-any.whl dist/youtube_closed_captions-1.0.0.tar.gz
These commands do not upload or publish the package. Live YouTube tests require network access and are skipped in CI because YouTube blocks datacenter IPs.
Metadata
Release files for youtube-closed-captions 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| youtube_closed_captions-1.0.0.tar.gz | 4.5 kB | Without provenance | Details for youtube_closed_captions-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| youtube_closed_captions-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for youtube_closed_captions-1.0.0-py3-none-any.whl |
Total release size: 10.1 kB
Release files / youtube_closed_captions-1.0.0.tar.gz
| Download URL | youtube_closed_captions-1.0.0.tar.gz |
|---|---|
| Size | 4.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a5be39555c5d7eb8f7b45e42e6fe1bd87326e41f1e8ee096fb978bd25760bf85
|
|
BLAKE2b-256 checksum How to use checksums |
27df08f4c268267f84281ca8d722c37a24886162ff2bdafdf9f48c591937a392
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / youtube_closed_captions-1.0.0-py3-none-any.whl
| Download URL | youtube_closed_captions-1.0.0-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ad0aff8e13a001a2761caf71c170ea185cea963fa3a99df78eb9591669a0ba84
|
|
BLAKE2b-256 checksum How to use checksums |
769fd7b78431fe93d55f0103ceb0730fd50ea00cdcf3608d771b3eb2d4bba67d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Security for youtube-closed-captions 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.