JamesKyburz/youtube-audio-stream

Update ytdl-core to latest

Closed this issue · 5 comments

Is there a way I could output stderr of ffmpeg. I am fairly new to node.

vagrant@beat:/var/www/html/node$ node app.js
Example app listening at http://0.0.0.0:3000

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: ffmpeg exited with code 1
    at ChildProcess.<anonymous> (/vagrant/node/node_modules/youtube-audio-stream/node_modules/fluent-ffmpeg/lib/processor.js:167:22)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at Process.ChildProcess._handle.onexit (child_process.js:797:12)

Here is my code:

var express = require('express');
var youtubeStream = require('youtube-audio-stream')
var app = express()

app.get('/', function(req, res) {
    res.send('Hello World!');
});

app.get('/get/:id', function(req, res) {

  var requestUrl = 'http://youtube.com/watch?v=' + req.params.id;

  try {
    youtubeStream(requestUrl).pipe(res);
  } catch(exception) {
    res.status(500).send(exception);
  }

});


var server = app.listen(3000, function () {
  var host = server.address().address
  var port = server.address().port
  console.log('Example app listening at http://%s:%s', host, port)
})

I was able to gather more data. Here is what I can get from fluent-ffmpeg stdout and stderr

ffmpeg version 0.8.9-6:0.8.9-0ubuntu0.13.04.1, Copyright (c) 2000-2013 the Libav developers
  built on Nov  9 2013 19:09:48 with gcc 4.7.3
*** THIS PROGRAM IS DEPRECATED ***
This program is only provided for compatibility and will be removed in a future release. Please use avconv instead.
Missing argument for option 'encoders'

encoding works using ffmpeg

ffmpeg -i small.mp4 -f mp3 music.mp3

I compiled a new version of ffmpeg here is what I got:

ffmpeg version 2.5.git Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.7 (Ubuntu/Linaro 4.7.3-1ubuntu1)
  configuration: --prefix=/home/vagrant/ffmpeg_build --extra-cflags=-I/home/vagrant/ffmpeg_build/include --extra-ldflags
=-L/home/vagrant/ffmpeg_build/lib --bindir=/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --
enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfr
ee
  libavutil      54. 19.100 / 54. 19.100
  libavcodec     56. 25.100 / 56. 25.100
  libavformat    56. 23.100 / 56. 23.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.100 /  5. 11.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100


events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: Input stream error: status code 403
    at PassThrough.<anonymous> (/vagrant/node/node_modules/youtube-audio-stream/node_modules/fluent-ffmpeg/lib/processor
.js:442:23)
    at PassThrough.EventEmitter.emit (events.js:117:20)
    at /vagrant/node/node_modules/youtube-audio-stream/node_modules/ytdl-core/lib/index.js:32:16
    at Request.<anonymous> (/vagrant/node/node_modules/youtube-audio-stream/node_modules/ytdl-core/lib/index.js:67:7)
    at Request.EventEmitter.emit (events.js:95:17)
    at Request.onResponse (/vagrant/node/node_modules/youtube-audio-stream/node_modules/ytdl-core/node_modules/request/r
equest.js:958:10)
    at ClientRequest.g (events.js:180:16)
    at ClientRequest.EventEmitter.emit (events.js:95:17)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (http.js:1688:21)
    at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:121:23)

Error: Input stream error: status code 403

Please update dependency ytdl-core Change ^0.2.4 to ^0.4.1

updated dependencies, could you please let me know if your http 403 issue is fixed.

Yes it is fixed. Thank you!