Last active
April 30, 2023 11:26
-
-
Save ikushlianski/1a5279e7d61f5c743be8011012268ab0 to your computer and use it in GitHub Desktop.
Export translations from the currently open Yandex Translate collection into Anki (TSV, CSV)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// open a collection in Yandex Translate and run the following script in your browser's developer console | |
function parseCollection() { | |
const arr = []; | |
document.querySelectorAll('.record-item_text > div:nth-child(2)').forEach(el => { | |
arr.push([el.textContent]) | |
}) | |
document.querySelectorAll('.record-item_translation > div:nth-child(2)').forEach((el, index) => { | |
arr[index][1] = el.textContent | |
}) | |
// change separator to a comma to get CSV format etc. | |
console.log(arr.map(row => row.join('\t')).join('\n')) | |
} | |
// Copy the resulting string into a new file with `tsv` extension. I use the TSV to batch import translations into Anki |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment