Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要从 YouTube URL 获取视频标题,我不知道该怎么做。我在两个不和谐的支持服务器上问过。到目前为止我已经得到了这个代码(我也在使用 YTDL-CORE)
const TEST = ytdl.getInfo('https://www.youtube.com/watch?v=YQHsXMglC9A', function (err, info) { console.log(info.videoDetails.title) // "Adele - Hello" });
有希望的不会达到所需的功能,因此不会打印标题。你应该做这样的事情,瞧。
ytdl.getInfo('https://www.youtube.com/watch?v=YQHsXMglC9A').then(info => { console.log(info.videoDetails.title); })
阿黛尔——你好