Skip to content

Instantly share code, notes, and snippets.

@karpitsky
Last active September 19, 2019 10:26
Show Gist options
  • Save karpitsky/29b49c3ae759a606b7db39ad3c3315ca to your computer and use it in GitHub Desktop.
Save karpitsky/29b49c3ae759a606b7db39ad3c3315ca to your computer and use it in GitHub Desktop.
Export Yandex Translate public collection
import string
import random
import requests
collection_id = '<YOUR COLLECTION ID>'
uid = ''.join(random.choices(string.digits, k=18))
cookies = {
'first_visit_src': 'collection_share_desktop',
'yandexuid': uid
}
url = 'https://translate.yandex.ru/props/api/collections/{}?srv=tr-text&uid'.format(collection_id)
response = requests.get(url, cookies=cookies).json()
for word in response['collection']['records']:
print('{} - {}'.format(word['text'], word['translation']))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment