最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Get youtube video title without API key - Stack Overflow

programmeradmin4浏览0评论

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
Add a ment  | 

1 Answer 1

Reset to default 9
const 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))
发布评论

评论列表(0)

  1. 暂无评论