Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kamui-fin/yt-to-anki
Simple anki addon to generate decks from youtube videos
https://github.com/kamui-fin/yt-to-anki
anki language-learning subs2srs subtitles ytdl
Last synced: about 1 month ago
JSON representation
Simple anki addon to generate decks from youtube videos
- Host: GitHub
- URL: https://github.com/kamui-fin/yt-to-anki
- Owner: kamui-fin
- License: gpl-3.0
- Created: 2020-05-28T15:45:03.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-06-09T04:31:05.000Z (7 months ago)
- Last Synced: 2024-06-09T05:31:53.597Z (7 months ago)
- Topics: anki, language-learning, subs2srs, subtitles, ytdl
- Language: Python
- Homepage: https://ankiweb.net/shared/info/964531817
- Size: 334 KB
- Stars: 21
- Watchers: 2
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.html
- License: LICENSE
Awesome Lists containing this project
README
An Anki addon that generates a full-fledged deck with audio and pictures from a YouTube link using subtitles with the click of a button. This eliminates the need for having to download a video, or the accompanying subtitles, re-timing them, and dealing with TSV files to import. For those of you familiar with Subs2SRS, consider this to be the YouTube version.
This addon offers several features:
- Supports all languages
- Fallback to automatically generated subs if man-made captions could not be found
- Set a limit to how many cards are generated
- Choose the dimensions of the pictures
- Fast card generation
Installation
- In
Tools > Addons
, clickGet addon
and use the code964531817
- Restart Anki for changes to take place
If you are a Linux or Mac user, make sure to install
ffmpeg
using your package manager.
Usage
- Enter the YouTube link for the video
- Choose the appropriate note type and fields for the card data
- Specify the subtitle language (default: English)
- Hit generate. After a bit, refresh your decks, and you should see a deck named after the title of the video
Quality of the subtitles
TL;DR: In order to get the best learning experience, work with the YouTube'svideos that have high-quality manually generated subtitles (e.g., TED talks).Enable option "Optimize subtitles" to get sentence-based Anki cards: one cardper sentence.
The YouTube to Anki (Y2A) extension uses subtitle ranges to cut the correspondingaudio fragments out of the downloaded video. If the subtitles are well-craftedby the creators of a YouTube video, the resulting Anki cards will 90%+ perfectlymatch the audio from the MP3 files generated by the extension.
YouTube's videos can have automatically and manually generated subtitles.
When a video has manually generated subtitles, it is likely to have:
- Capitalized sentences and correct punctuation.
- Subtitle ranges matching the actual sentences as they are spoken on a video.
For the manually generated subtitles, the Y2A extension provides an optimizationwhich merges the subtitle texts so that the full sentences are formed, onesentence per one Anki card. The optimization relies on the punctuation foundin the subtitles, e.g. ".", ",", "?" in order to decide when a sentence shouldend. The option is enabled with the "Optimize subtitles" flag.
Examples of good YouTube videos that can be used for testing this extension:
- The strongest predictor for success | Angela Lee Duckworth
- Elon Musk: A future worth getting excited about | TED | Tesla Texas Gigafactory interview
When a video has automatically generated subtitles, it is most often that theextension cannot produce good Anki cards: the subtitle text will have neithercapitalized letters nor punctuation, and therefore the Anki cards will not besentence-based.
Development
Before moving on, be sure you have python
and poetry
setup.
- Clone the repository
git clone https://github.com/kamui-fin/yt-to-anki.gitcd yt-to-anki
- Install dependencies
poetry install
- Install pre-commit hooks
poetry run pre-commit install
- If you are on windows, you need to create a top-level directory called
ffmpeg
withffmpeg.exe
inside - Bundle everything (or update the bundle)
poetry run invoke package-dev
- Create a symlink of
dist/
inside of your Anki data'saddons21/
folder
ln -s ./dist ~/.local/share/Anki2/addons21/yt-to-anki
- Now you can use the
dev
command for simultaneously running anki with the updated bundle
poetry run invoke dev
Contributing
All contributions are gladly welcomed! Feel free to open an issue or create a pull request if you have any new changes/ideas in mind.