-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathREADME.html
56 lines (34 loc) · 4.34 KB
/
README.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
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:
<ul><li>Supports all languages</li><li>Fallback to automatically generated subs if man-made captions could not be found</li><li>Set a limit to how many cards are generated</li><li>Choose the dimensions of the pictures</li><li>Fast card generation</li></ul>
<b><i>Installation</i></b>
<ol><li>In <code>Tools > Addons</code>, click <code>Get addon</code> and use the code <code>964531817</code></li><li>Restart Anki for changes to take place</li></ol>
If you are a Linux or Mac user, make sure to install <code>ffmpeg</code> using your package manager.
<b><i>Usage</i></b>
<ol><li>Enter the YouTube link for the video</li><li>Choose the appropriate note type and fields for the card data</li><li>Specify the subtitle language (default: English)</li><li>Hit generate. After a bit, refresh your decks, and you should see a deck named after the title of the video</li></ol>
<b><i>Quality of the subtitles</i></b>
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:
<ul><li>Capitalized sentences and correct punctuation.</li><li>Subtitle ranges matching the actual sentences as they are spoken on a video.</li></ul>
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:
<ul><li><a href="https://www.youtube.com/watch?v=GfF2e0vyGM4&list=PLsJDRmMjwANLfCZxb25npMoR3aWFIpSRA&index=2&t=42s">The strongest predictor for success | Angela Lee Duckworth</a></li><li><a href="https://www.youtube.com/watch?v=YRvf00NooN8&t=265s">Elon Musk: A future worth getting excited about | TED | Tesla Texas Gigafactory interview</a></li></ul>
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.
<b><i>Development</i></b>
Before moving on, be sure you have <code>python</code> and <code>poetry</code> setup.
<ol><li>Clone the repository</li></ol>
<code>git clone https://github.com/kamui-fin/yt-to-anki.gitcd yt-to-anki</code>
<ol start="2"><li>Install dependencies</li></ol>
<code>poetry install</code>
<ol start="3"><li>Install pre-commit hooks</li></ol>
<code>poetry run pre-commit install</code>
<ol start="4"><li>If you are on windows, you need to create a top-level directory called <code>ffmpeg</code> with <a href="https://github.com/BtbN/FFmpeg-Builds/releases"><code>ffmpeg.exe</code></a> inside</li><li>Bundle everything (or update the bundle)</li></ol>
<code>poetry run invoke package-dev</code>
<ol start="6"><li>Create a symlink of <code>dist/</code> inside of your Anki data's <code>addons21/</code> folder</li></ol>
<code>ln -s ./dist ~/.local/share/Anki2/addons21/yt-to-anki</code>
<ol start="7"><li>Now you can use the <code>dev</code> command for simultaneously running anki with the updated bundle</li></ol>
<code>poetry run invoke dev</code>
<b><i>Contributing</i></b>
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.