I need to get a title from YouTube video. How can I change a request from this library to be async? Actually this returns undefined
this is a vue.js app
async addNewVideoToLocalStorage() {
let id = getIdFromURL(this.videosUrl[0].url);
let title = await getYoutubeTitle(id, async (e, t) => await t);
}
data: () => ({
title: "",
})
async get_title() {
var getYoutubeTitle = require('get-youtube-title');
let id = 'QR1jRM4XTyc';
await getYoutubeTitle(id, (e, t) => {
return this.title = t
})
console.log(this.title);
}
async , await cannot work in getYoutubeTitle 🥺
try this way