tokland / youtube-upload

Upload videos to Youtube from the command line
2.08k stars 465 forks source link

socket.error: [Errno 104] Connection reset by peer #111

Closed MarvinBeym closed 8 years ago

MarvinBeym commented 8 years ago

100% |###############################################| Time: 0:15:49 987.0 KiB/s Traceback (most recent call last): File "/usr/local/bin/youtube-upload", line 10, in main.run() File "/usr/local/lib/python2.7/dist-packages/youtube_upload/main.py", line 251, in run sys.exit(lib.catch_exceptions(EXIT_CODES, main, sys.argv[1:])) File "/usr/local/lib/python2.7/dist-packages/youtube_upload/lib.py", line 39, in catch_exceptions fun(_args, *_kwargs) File "/usr/local/lib/python2.7/dist-packages/youtube_upload/main.py", line 246, in main run_main(parser, options, args) File "/usr/local/lib/python2.7/dist-packages/youtube_upload/main.py", line 178, in run_main video_id = upload_youtube_video(youtube, options, video_path, len(args), index) File "/usr/local/lib/python2.7/dist-packages/youtube_upload/main.py", line 140, in upload_youtube_video request_body, progress_callback=progress.callback) File "/usr/local/lib/python2.7/dist-packages/youtube_upload/upload_video.py", line 40, in upload RETRIABLE_EXCEPTIONS, max_retries=max_retries) File "/usr/local/lib/python2.7/dist-packages/youtube_upload/lib.py", line 75, in retriable_exceptions raise exc socket.error: [Errno 104] Connection reset by peer

Uploading from Raspberry pi over the night after looking if its finished this error appierd

emmtte commented 8 years ago

Same for me, sometimes it's appens. I've write a bash script to restart upload when error came.

https://github.com/ManuCart/RaspberryPi/blob/master/scripts/youtube-upload

MarvinBeym commented 8 years ago

doesnt really help when you only have 16k internet speed (100kbit/s Upload) I need the hole night to upload and if it fails ....

tokland commented 8 years ago

Please try with chunksize=-1 (upload_video.py, function updoad)

MarvinBeym commented 8 years ago

ok i will try this when im back home, but im also getting Problems with Google. Im getting E-mails from Google that a login was blocked everytime i start the upload

pinoepel commented 8 years ago

I use my Diskstation with this script, DonnerPlays and ManuCart too?

Same with chunksize=-1:

My upload.sh:

!/usr/bin/python

!/bin/bash

cd /volume1/photo/youtube-upload-master

youtube-upload --title="01" --description="PLAYLIST" --category=Gaming --tags="Lets Play,letsplay,Review,Walkthrough,German,Deutsch,Gameplay,Kommentiertes Spiel" --default-language="de" --default-audio-language="de" /volume1/photo/youtube/mp4/01.mp4 mv /volume1/photo/youtube/mp4/01.mp4 /volume1/photo/youtube/hochgeladen

My log:

Using client secrets: /usr/share/youtube_upload/client_secrets.json Using credentials file: /root/.youtube-upload-credentials.json Using category: Gaming (id=20) Start upload: /volume1/photo/youtube/mp4/01.mp4 Traceback (most recent call last): File "/bin/youtube-upload", line 10, in main.run() File "/usr/lib/python2.7/site-packages/youtube_upload/main.py", line 251, in run sys.exit(lib.catch_exceptions(EXIT_CODES, main, sys.argv[1:])) File "/usr/lib/python2.7/site-packages/youtube_upload/lib.py", line 39, in catch_exceptions fun(_args, *_kwargs) File "/usr/lib/python2.7/site-packages/youtube_upload/main.py", line 246, in main run_main(parser, options, args) File "/usr/lib/python2.7/site-packages/youtube_upload/main.py", line 178, in run_main video_id = upload_youtube_video(youtube, options, video_path, len(args), index) File "/usr/lib/python2.7/site-packages/youtube_upload/main.py", line 140, in upload_youtube_video request_body, progress_callback=progress.callback) File "/usr/lib/python2.7/site-packages/youtube_upload/upload_video.py", line 40, in upload RETRIABLE_EXCEPTIONS, max_retries=max_retries) File "/usr/lib/python2.7/site-packages/youtube_upload/lib.py", line 75, in retriable_exceptions raise exc socket.error: [Errno 104] Connection reset by peer

MarvinBeym commented 8 years ago

Ok i have uploaded 4 Videos since the problem, now im getting the error again, i had changed the chunksize=-1 still error...

tokland commented 8 years ago

Try https://github.com/tokland/youtube-upload/tree/more-retry-exceptions , let's see if retrying solves the problem

MarvinBeym commented 8 years ago

wait... what should i do with the link?

tokland commented 8 years ago

checkout the code from that branch and try it.

MarvinBeym commented 8 years ago

ok im dumb... will try it :)

MarvinBeym commented 8 years ago

ok what i did was: i redownloaded the script and done [sudo python setup.py install] again, is that correct?

tokland commented 8 years ago

yes

MarvinBeym commented 8 years ago

Ok :D will try over the time and will tell you if it worked

tokland commented 8 years ago

No feedback

roughnecks commented 8 years ago

Hi there. Sorry for opening this up again but I got the same issue as Donner while uploading a 2.55GB file. I'm running a PIII with 512MB RAM and Debian 8, upload running overnight over a FTTC VDSL 30/3 Mbit/s. Internet connection is very stable but there's more: that machine is configured with a dual stack IPv4 and IPv6 via SIXXS broker, so it could be possible that the upload went trough IPv6..

Do you have any idea if that might be the problem or I should try the alternate branch you suggested earlier, before messing up with my network config?

Thanks

tokland commented 8 years ago

@roughnecks did you try the https://github.com/tokland/youtube-upload/tree/more-retry-exceptions branch? (706207ba)

roughnecks commented 8 years ago

As I said in the previous post, haven't tried it yet, was asking for your advice on how to continue.

I can do some tests but I'm not a youtube enthusiast, so it will probably take me some time. Feel free to close this thread again, if you feel like it.

tokland commented 8 years ago

Sorry, didn't see it. Yes, I'd first test the commit from that branch and if this does not work, I'd play with different values of chunksize. I don't have problems uploading from my linode, I cannot reproduce.

roughnecks commented 8 years ago

Alright, thanks :+1:

roughnecks commented 8 years ago

It's me again, last night I left a video uploading (using the git branch you adviced) and today I found out it had crashed again:

lab@nadir:~/clones/youtube-upload-more-retry$ python bin/youtube-upload --title="Krai Mira: Mushrooms Dreams" --privacy private /mnt/Data/lab/Temp-Scrivibile/Krai.mkv                                                                 
Using client secrets: /home/lab/.client_secrets.json
Using credentials file: /home/lab/.youtube-upload-credentials.json
Start upload: /mnt/Data/lab/Temp-Scrivibile/Krai.mkv
100% |####################################################################################################################################################################################################################| 566.08 kB/s
Traceback (most recent call last):
  File "bin/youtube-upload", line 10, in <module>
    main.run()
  File "/home/lab/clones/youtube-upload-more-retry/bin/../youtube_upload/main.py", line 250, in run
    sys.exit(lib.catch_exceptions(EXIT_CODES, main, sys.argv[1:]))
  File "/home/lab/clones/youtube-upload-more-retry/bin/../youtube_upload/lib.py", line 39, in catch_exceptions
    fun(*args, **kwargs)
  File "/home/lab/clones/youtube-upload-more-retry/bin/../youtube_upload/main.py", line 245, in main
    run_main(parser, options, args)
  File "/home/lab/clones/youtube-upload-more-retry/bin/../youtube_upload/main.py", line 177, in run_main
    video_id = upload_youtube_video(youtube, options, video_path, len(args), index)
  File "/home/lab/clones/youtube-upload-more-retry/bin/../youtube_upload/main.py", line 139, in upload_youtube_video
    request_body, progress_callback=progress.callback)
  File "/home/lab/clones/youtube-upload-more-retry/bin/../youtube_upload/upload_video.py", line 40, in upload
    RETRIABLE_EXCEPTIONS, max_retries=max_retries)
  File "/home/lab/clones/youtube-upload-more-retry/bin/../youtube_upload/lib.py", line 75, in retriable_exceptions
    raise exc
socket.error: [Errno 104] Connection reset by peer
tokland commented 8 years ago

File "/home/lab/clones/youtube-upload-more-retry/bin/../youtube_upload/lib.py", line 75

Are you sure that you are using the branch version? an exception raised here it's a signal that it was an unretriable exception, but, in that branch, youtube_upload/upload_video.py has socket.error included in RETRIABLE_EXCEPTIONS.

roughnecks commented 8 years ago

My bad. You're right: when I cloned the repo, I went to the desired branch in github and copied the link but it cloned the master one, not sure if I did it wrong or it's just supposed to work this way.

Now I manually switched branch in terminal, will upload the same video shortly. Sorry

roughnecks commented 8 years ago

Alright, this time it went through just fine :-)

Excuse me, but is there an option to not publish videos when the upload is done? I saw a "delayed publication" option but I'd rather do it myself, because sometimes I need to edit my videos.

Thanks

tokland commented 8 years ago

Ok, thanks for testing, I'll merge it to master then.

but is there an option to not publish videos when the upload is done?

See the option:

  --publish-at=datetime
                        Publish date (ISO 8601): YYYY-MM-DDThh:mm:ss.sZ
roughnecks commented 8 years ago

So, i just set it to some days in the future and publish it myself manually when I'm done?

tokland commented 8 years ago

tbh it was a contribution and i've never used that option, but my understanding is that youtube will take care of publishing the video when the time arrives.

roughnecks commented 8 years ago

I read about that, yes, but my wish is to NOT publish at all. I need to edit vids before they are published and notifications sent to subscribers.

tokland commented 8 years ago

Oh, I see. What about uploading the video as private and, once reviewed, set it to public?

--privacy=STRING Privacy status (public | unlisted | private)

roughnecks commented 8 years ago

Yes, that would do (not sure if notifications will be sent when I set it to public or upon publishing as private, but it's OK).

You can close this issue whenever you want. Thanks again for helping me out and for your nice project.

tokland commented 8 years ago

Never tried it myself, but it should

The issue was already closed some weeks ago, I forgot to re-open it :)

Good luck