Skip to content

Instantly share code, notes, and snippets.

@ikushlianski
Last active April 30, 2023 11:26
Show Gist options
  • Save ikushlianski/1a5279e7d61f5c743be8011012268ab0 to your computer and use it in GitHub Desktop.
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)
// 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