shiffman / vimeo-to-youtube

An app to transfer a video catalogue from Vimeo to Youtube
5 stars 3 forks source link

timing out with large video files? #2

Open shiffman opened 9 years ago

shiffman commented 9 years ago

The youtube uploader works great with my small test file transit.mov but as soon as I go to a larger file (~250 MB), it fails. It seems to be timing out? Perhaps I should implement a progress bar or something to keep the connection alive?

cc @IonicaBizau in case you have any ideas.

Current error (token redacted):

error [14:15.33 - 09.07.2015] /oauth2callback?code=4/...............................: TypeError: object is not a function
    at /Users/danielshiffman/Documents/vimeo-to-youtube/youtube_upload.js:63:11
    at /Users/danielshiffman/Documents/vimeo-to-youtube/node_modules/youtube-api/node_modules/googleapis/node_modules/google-auth-library/lib/auth/oauth2client.js:154:5
    at Request._callback (/Users/danielshiffman/Documents/vimeo-to-youtube/node_modules/youtube-api/node_modules/googleapis/node_modules/google-auth-library/lib/transporters.js:103:7)
    at Request.self.callback (/Users/danielshiffman/Documents/vimeo-to-youtube/node_modules/youtube-api/node_modules/googleapis/node_modules/google-auth-library/node_modules/request/request.js:373:22)
    at Request.emit (events.js:110:17)
    at Request.<anonymous> (/Users/danielshiffman/Documents/vimeo-to-youtube/node_modules/youtube-api/node_modules/googleapis/node_modules/google-auth-library/node_modules/request/request.js:1318:14)
    at Request.emit (events.js:129:20)
    at IncomingMessage.<anonymous> (/Users/danielshiffman/Documents/vimeo-to-youtube/node_modules/youtube-api/node_modules/googleapis/node_modules/google-auth-library/node_modules/request/request.js:1266:12)
    at IncomingMessage.emit (events.js:129:20)
    at _stream_readable.js:908:16
shiffman commented 9 years ago

Interestingly the video does in fact make it to youtube if I wait long enough. But I have no way of knowing status / progress and the error is disconcerting. Looking into this more. . .

IonicaBizau commented 9 years ago

at /Users/danielshiffman/Documents/vimeo-to-youtube/youtube_upload.js:63:11

Hmm, there is nothing relevant. Did you push the latest changes?

shiffman commented 9 years ago

Ah, shoot I think I was mucking around with the code and this error doesn't match up. Updating momentarily.

shiffman commented 9 years ago

Updated error:

error [14:33.54 - 09.07.2015] /oauth2callback?code=4/...............: TypeError: object is not a function
    at /Users/danielshiffman/Documents/vimeo-to-youtube/youtube_upload.js:59:11
    at /Users/danielshiffman/Documents/vimeo-to-youtube/node_modules/youtube-api/node_modules/googleapis/node_modules/google-auth-library/lib/auth/oauth2client.js:154:5
    at Request._callback (/Users/danielshiffman/Documents/vimeo-to-youtube/node_modules/youtube-api/node_modules/googleapis/node_modules/google-auth-library/lib/transporters.js:103:7)
    at Request.self.callback (/Users/danielshiffman/Documents/vimeo-to-youtube/node_modules/youtube-api/node_modules/googleapis/node_modules/google-auth-library/node_modules/request/request.js:373:22)
    at Request.emit (events.js:110:17)
    at Request.<anonymous> (/Users/danielshiffman/Documents/vimeo-to-youtube/node_modules/youtube-api/node_modules/googleapis/node_modules/google-auth-library/node_modules/request/request.js:1318:14)
    at Request.emit (events.js:129:20)
    at IncomingMessage.<anonymous> (/Users/danielshiffman/Documents/vimeo-to-youtube/node_modules/youtube-api/node_modules/googleapis/node_modules/google-auth-library/node_modules/request/request.js:1266:12)
    at IncomingMessage.emit (events.js:129:20)
    at _stream_readable.js:908:16
IonicaBizau commented 9 years ago

Ah, indeed. Opened #3. :smile:

IonicaBizau commented 9 years ago

@shiffman It looks like the auth code is incorrect or the token generation fails anyway. BTW, if you already have the token, use it, don't create another one.

PS. I just watched one of your videos. Man, you're awesome! :sparkles: :laughing:

shiffman commented 9 years ago

Ok, so that error was a misdirection. And it works now. But strangely instead of seeing it finish, it seems to run again (?) and the message I end up with in the browser is:

{
  "contentType": "html",
  "buffer": "Error: invalid_grant"
}

In the console:

$ node youtube_upload.js 
info  Trying to get the token using the following code: 4/nj6i7R57......-fllFHdXEzx8FeM1Y
uploading video: 0
info  Trying to get the token using the following code: 4/nj6i7R57......-fllFHdXEzx8FeM1Y
error invalid_grant
shiffman commented 9 years ago

It looks like the auth code is incorrect or the token generation fails anyway. BTW, if you already have the token, use it, don't create another one.

@IonicaBizau are you suggesting that I save the token from one running of the server to another or within the app itself make sure I only request a single token for uploading many videos?

IonicaBizau commented 9 years ago

I speculate the browser makes a second request with the same code (indeed) and the invalid_grant is expected, since the code was already used.

So, I'd say it would be better to end the response immediately and show additional logs in console.

...or if you want to make it fancy, to it with web sockets. :smile:

IonicaBizau commented 9 years ago

@IonicaBizau are you suggesting that I save the token from one running of the server to another or within the app itself make sure I only request a single token for uploading many videos?

Since you got the token, use it for all uploads, so you don't need to regenerate it (it also saves time not to open browser pages for each video).