Q
Q
qwerty2018-01-28 18:31:21
JavaScript
qwerty, 2018-01-28 18:31:21

Yandex disk api Cyrillic in the link?

I am using the request library to get the page code.
The url variable contains a link that contains an example in Cyrillic:

https://cloud-api.yandex.net/v1/disk/public/resources/download?public_key=ССЫЛКА_НА_ДИСК&path=/ИМЯ_ФАЙЛА.pdf

So if you follow such a link from google chrome, then the answer will be normal, and if you request the contents of this page using the request library, the answer will be like this
{"message":"Не удалось найти запрошенный ресурс.","description":"Resource not found.","error":"DiskNotFoundError"}

The fact is that the browser converts Cyrillic and from
api.yandex.net/v1/disk/public/resources/download?public_key=ССЫЛКА_НА_ДИСК&path=/ИМЯ_ФАЙЛА.pdf

it turns out
http://api.yandex.net/v1/disk/public/resources/download?public_key=%D1%D1%DB%CB%CA%C0_%CD%C0_%C4%C8%D1%CA&path=/%C8%CC%DF_%D4%C0%C9%CB%C0.pdf

And for Yandex, this is a completely different link. Why? save

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question