Advertisement
justririll

Untitled

Jan 18th, 2022
743
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import json
  2. import urllib.request
  3.  
  4. headers = {
  5.     'Content-Type': 'application/json',
  6.     'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 11_4) AppleWebKit/605.1.15 '
  7.                   '(KHTML, like Gecko) Version/14.1.1 Safari/605.1.15',
  8.     'Origin': 'https://yandex.ru',
  9.     'Referer': 'https://yandex.ru/',
  10. }
  11.  
  12.  
  13. API_URL = 'https://zeapi.yandex.net/lab/api/yalm/text3'
  14. payload = {"query": "стареге", "intro": 0, "filter": 1}
  15. params = json.dumps(payload).encode('utf8')
  16. req = urllib.request.Request(API_URL, data=params, headers=headers)
  17. response = urllib.request.urlopen(req)
  18. res = json.loads(response.read().decode('utf8'))
  19. print(res)
  20.  
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement