【问题标题】:Why YouTube-dl download only link come from YouTube in meteorjs app?为什么 YouTube-dl 仅下载链接来自于流星应用程序中的 YouTube?
【发布时间】:2016-02-27 02:18:25
【问题描述】:

我检查了所有处理 YouTube-dl 问题的问题,但没有发现与我的问题相同的问题;

当我在我的 meteorjs 应用程序中下载带有节点 YouTube-dl 的 YouTube 视频时,一切正常(在 chrome 中),除了在 Firefox 中在新选项卡中打开视频而不是下载它;但是当我尝试从其他网站(如 Facebook、Twitter 或其他任何网站)下载视频(Chrome 版)时,它会在控制台中抛出此错误

Error: Internal server error [500]

这个在终端上

Exception while invoking method 'commandliiiine'Error: No video id found: https://www.facebook.com/sawtelghad/videos/1070722126318944/ 

这是我在服务器中的代码

 var ytdl = Meteor.npmRequire('ytdl-core');
  var Future = Meteor.npmRequire("fibers/future");

Meteor.methods({
    'commandliiiine': function(url){

      this.unblock();
      var future = new Future();

      ytdl.getInfo(url, function(err, result) {

        future.return(result);
      }); 

      return future.wait();
    }
});

这是客户端中的代码

 Meteor.call('commandliiiine', url, function(error, result){
        if (result) {
          Session.set('videoTitle', result.title);
          Session.set('videoImage', result.thumbnail_url);




       } else {
          console.log('error:'+ error);
       }
      });

这是我使用的 youtube-dl 版本:"ytdl-core":"0.7.9"

谁能帮我解决这个问题!!请

非常感谢

【问题讨论】:

  • @Roemer,你能告诉我你编辑我的问题的内容和原因吗!!
  • 我删除了“Facebook”标签,因为您的问题与此无关。
  • @Roemer 所以,脸书上没有视频可以下载??

标签: javascript video meteor youtube


【解决方案1】:

你的提交 URL 功能是什么?

此外,我还检查了 Facebook,在您返回给客户端的结果对象中,例如没有任何 thumbnail_url。

将您的代码更改为:

Meteor.call('commandliiiine', url, function(error, result){
    if (result) {
      console.log(result);
   } else {
      console.log('error:'+ error);
   }
  });

然后在 Chrome 上打开开发者控制台并查看您返回的对象。您只能访问为每个视频共享站点打印的对象密钥。

【讨论】:

  • 控制台没有结果,如我之前解释的那样抛出错误
猜你喜欢
  • 1970-01-01
  • 2015-11-11
  • 2018-07-03
  • 2016-12-08
  • 1970-01-01
  • 2021-07-24
  • 2017-01-29
  • 2015-02-12
相关资源
最近更新 更多