K
K
Kirill Gorelov2020-03-10 17:36:11
JavaScript
Kirill Gorelov, 2020-03-10 17:36:11

Yandex Disk view image preview?

Hello.
Guys use rest api yandex to get pictures.
Everything is fine, I get a list of pictures, but when viewed in a browser, Yandex gives pictures with a 403 error.
What is the correct way to display the image?
So far, for example, I have sketched such a sprit.

data.data.forEach(element => {
                console.log(element);
                id = document.createElement('img'); 
                id.setAttribute('src', element._embedded.items['0'].preview);
                document.getElementById('dir_preview').appendChild(id);
            });


And the result is this.
spoiler

5e67a5909adbe624622291.png


If you directly open the link, the picture is displayed.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2020-03-10
@dimonchik2013

antihotlink

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question