Skip to main content

Downloads and processes parallel YouTube subtitles with eSpeak IPA generation.

Project description

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.

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

yt_parallel-1.0.1.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

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

yt_parallel-1.0.1-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file yt_parallel-1.0.1.tar.gz.

File metadata

  • Download URL: yt_parallel-1.0.1.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for yt_parallel-1.0.1.tar.gz
Algorithm Hash digest
SHA256 928e0ec12c0507b76c7071bc1fce7af81bc01b7e7eaa4e844c008295c3899529
MD5 af792e3ae96ffa841b9878268a544059
BLAKE2b-256 793fbe47b1e66580cef110f29355d3fac5c50beedc0344a53bd4261a6018b1d6

See more details on using hashes here.

File details

Details for the file yt_parallel-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: yt_parallel-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for yt_parallel-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5f93bd7c0c1c2f3333574cecbcd3151af61c8ba5f050c7e65295caa0d3653733
MD5 da5ceab0f26b35a65b1243a7802268d0
BLAKE2b-256 dac5dc97fadcb0815c0baceed2b70e8e3405381568e9e628bdc85af538d7d9a6

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