Last active
          September 19, 2019 10:26 
        
      - 
      
- 
        Save karpitsky/29b49c3ae759a606b7db39ad3c3315ca to your computer and use it in GitHub Desktop. 
    Export Yandex Translate public collection
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | 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