Answer the question
In order to leave comments, you need to log in
How to display received data from youtube api in html as video?
Hello!
Please tell me how to display the received data from the youtube api on the html page.
const apiKey = 'my_key';
const url = 'https://www.googleapis.com/youtube/v3/search?part=snippet&q=heroes%3&type=video&key=my_key';
const mainVideo = document.getElementById('main_video')
fetch(url).then(function(response) {
response.text().then(function(text) {
let newText = JSON.parse(text)
mainVideo.innerText = newText;
console.log(newText)
});
});
<aside class="video main-content-right" id="main_video">
<h2>Video Here</h2>
<iframe src="" id="myIframe"></iframe>
</aside>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question