@joshyzou/getyoutubelinks
Version:
Searches youtube for the best video that matches your string, and returns the link and title of that video
17 lines (14 loc) • 474 B
JavaScript
module.exports = async function music(song){
const YouTube = require("discord-youtube-api");
const youtube = new YouTube("google api key");
const ytdl = require("ytdl-core");
var youtubesearchapi=require('youtube-search-api');
let video3 = await youtubesearchapi.GetListByKeyword(song);
title = video3.items[0].title;
let video4 = video3.items[0].id;
finallink = "https://youtube.com/watch?v=" + video4;
return {
link: finallink,
title: title
};
}