Skip to main content

yt parallel

@readwithai - X - blog - machine-aided reading - 📖⚡️🖋️

Create parallel lyrics in two languages for a song downloaded from youtube using their autotranslated lyrics.

This is related to the idea of parallel corpora for language learning. You likely adapt this tool to your use cases - such as burning text into youtube videos.

Motivation

I want to exercise a lot, but it frequently feels kind of pointless. I am trying to learn danish so I want to play songs in danish, but I also want to understand the lyrics. The ideal solution would be have the lyrics while I play - but there is nothing on the meta quest which does this immediately and I want something now.

Therefore, the solution I am going for is hanging the lyrics open on a tabet attached to the wall which I can quicky look at. This program is for this. It creates an html page.

Installation

You can install yt-parallel using pipx:

pipx install yt-parallel

You also must install yt-dlp with pipx and espeak (you can install this with apt on linux)

Usage

This tool wraps yt-dlp which often needs cookies a browser which has logged into youtube to wor. If you use chrome you need only log into youtube in this browser. For other browsers you can use the YT_PARALLEL_COOKIES variable set the --cookies-from-browser option in yt-dlp. Remember to add the browser type like chromium: to this string.

You can then run:

yt-parallel 'https://www.youtube.com/watch?v=MhghQ3AFCe0' da en

If you are learning danish in english.

Troubleshooting

Errors related to Too Many Requests can occur if you are not logged into youtube. Ensure you are logged in in a browser and try changing YT_PARALLEL_COOKIES. You likely want to try getting yt-dlp working directly.

If this is still a problem you might like to change the --impersonate setting.

ERROR: Unable to download video subtitles for 'en': HTTP Error 429: Too Many Requests

Alternatives and prior work

This tool uses yt-dlp and espeak.

There are many commercial interactive tools which provide similar features and allow you to listen to music or watch films while seeing lyrics in two languages. Language reactor is one such example and works with youtube.

opus provide parallel corpora of sentence pairs (which incidentally can be rebuilt into copmlete parallel corpora for movies).

There are tools for sentence alignment which can be fed books in two languages to create parallel books. You can also buy books in two languages at the same time.

Looks like ffmpeg can extract subtitles from films in different languages which can then be combined and "burned it".

However, my use case is lyrics that I can look at while playing beat saber.

About me

I am @readwithai. I create tools for reading, research and agency sometimes using the markdown editor Obsidian.

I also create a stream of tools that are related to carrying out my work.

I write about lots of things - including tools like this - on X. My blog is more about reading and research and agency.

I am also interested in Virtual reality. I also have a personal wiki about using the game Pistol whip for VR fitness.

Metadata

Release files for yt-parallel 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yt-parallel 1.0.1
File Size Uploaded Provenance Actions
yt_parallel-1.0.1.tar.gz 6.9 kB Without provenance Details for yt_parallel-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for yt-parallel 1.0.1
File Interpreter ABI Platform Actions
yt_parallel-1.0.1-py3-none-any.whl Python 3 none any Details for yt_parallel-1.0.1-py3-none-any.whl

Total release size: 13.7 kB

Release files / yt_parallel-1.0.1.tar.gz

Download URL yt_parallel-1.0.1.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
928e0ec12c0507b76c7071bc1fce7af81bc01b7e7eaa4e844c008295c3899529
BLAKE2b-256 checksum
How to use checksums
793fbe47b1e66580cef110f29355d3fac5c50beedc0344a53bd4261a6018b1d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / yt_parallel-1.0.1-py3-none-any.whl

Download URL yt_parallel-1.0.1-py3-none-any.whl
Size 6.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5f93bd7c0c1c2f3333574cecbcd3151af61c8ba5f050c7e65295caa0d3653733
BLAKE2b-256 checksum
How to use checksums
dac5dc97fadcb0815c0baceed2b70e8e3405381568e9e628bdc85af538d7d9a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for yt-parallel 1.0.1

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.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page