I am able to get the title of a youtube video without using and api key using the jQuery code below, how can I use ES6 fetch
to do the same?
const vidurl = '';
$.getJSON('',
{dataType: 'json', url: vidurl}, data => {
console.log("JQUERY", data.title);
});
I am able to get the title of a youtube video without using and api key using the jQuery code below, how can I use ES6 fetch
to do the same?
const vidurl = 'https://www.youtube./watch?v=dQw4w9WgXcQ';
$.getJSON('https://noembed./embed',
{dataType: 'json', url: vidurl}, data => {
console.log("JQUERY", data.title);
});
Share
Improve this question
asked Sep 27, 2020 at 23:05
user2965653user2965653
171 silver badge4 bronze badges
1
- yes, that would be okay too, the example above is from stackoverflow./questions/30084140/… jsbin./cufedixoju/edit?html,js,console,output – user2965653 Commented Sep 27, 2020 at 23:14
1 Answer
Reset to default 9const vidurl = 'https://www.youtube./watch?v=I_izvAbhExY';
fetch(`https://noembed./embed?dataType=json&url=${vidurl}`)
.then(res => res.json())
.then(data => console.log('fetch', data.title))