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.0.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.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: yt_parallel-1.0.0.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.0.tar.gz
Algorithm Hash digest
SHA256 aaa6a7848c9777da8c528bc5d42316cfff5ca4b08b3dacf21a74690be2537726
MD5 943fb5ce429486d674f52d548cdb09c5
BLAKE2b-256 9ec970c70780a1e844b48bfe66ed9a63a9fc48eaee14c289873ebd4af87c8a6d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: yt_parallel-1.0.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5cd0808a39d67fecd89f04940a1f61c0bf0b4f2bb8e2306ad1fdc7b0e37f475f
MD5 e4b080490f148531faf9608d84732e3f
BLAKE2b-256 24d0f58430ebf75588199a6935e5260784238fe33b49adc24c8b2f85cf9da41a

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