tokland / youtube-upload

Upload videos to Youtube from the command line
2.06k stars 464 forks source link

httplib2.error.RedirectMissingLocation: Redirected but the response is missing a Location: header. #335

Closed obiwankennedy closed 2 years ago

obiwankennedy commented 2 years ago

Describe the bug My script worked like a charm on Ubuntu 18.04 for a while. I updated to 20.04 and I'm trying to make it work but I can't upload video.

I'm getting this error: 

Using client secrets: /path/client_secret.json
Using credentials file: /path/.youtube-upload-credentials.json
Start upload: /path/Games/RPG/werewolf/31/normalized-video-episode_31.mp4
Traceback (most recent call last):
  File "/path/youtube-upload", line 10, in <module>
    main.run()
  File "/path/python3.8/dist-packages/youtube_upload/main.py", line 262, in run
    sys.exit(lib.catch_exceptions(EXIT_CODES, main, sys.argv[1:]))
  File "/path/python3.8/dist-packages/youtube_upload/lib.py", line 42, in catch_exceptions
    fun(*args, **kwargs)
  File "/path/python3.8/dist-packages/youtube_upload/main.py", line 256, in main
    run_main(parser, options, args)
  File "/path/python3.8/dist-packages/youtube_upload/main.py", line 179, in run_main
    video_id = upload_youtube_video(youtube, options, video_path, len(args), index)
  File "/path/python3.8/dist-packages/youtube_upload/main.py", line 139, in upload_youtube_video
    video_id = upload_video.upload(youtube, video_path, 
  File "/path/python3.8/dist-packages/youtube_upload/upload_video.py", line 41, in upload
    return lib.retriable_exceptions(upload_fun, 
  File "/path/python3.8/dist-packages/youtube_upload/lib.py", line 74, in retriable_exceptions
    raise exc
  File "/path/python3.8/dist-packages/youtube_upload/lib.py", line 70, in retriable_exceptions
    return fun()
  File "/path/python3.8/dist-packages/youtube_upload/upload_video.py", line 40, in <lambda>
    upload_fun = lambda: _upload_to_request(request, progress_callback)
  File "/path/python3.8/dist-packages/youtube_upload/upload_video.py", line 24, in _upload_to_request
    status, response = request.next_chunk()
  File "/pathpython3.8/site-packages/googleapiclient/_helpers.py", line 131, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/path/python3.8/site-packages/googleapiclient/http.py", line 1083, in next_chunk
    resp, content = http.request(
  File "/path/python3.8/site-packages/oauth2client/transport.py", line 173, in new_request
    resp, content = request(orig_request_method, uri, method, body,
  File "/path/python3.8/site-packages/oauth2client/transport.py", line 280, in request
    return http_callable(uri, method=method, body=body, headers=headers,
  File "/path/python3.8/site-packages/httplib2/__init__.py", line 1708, in request
    (response, content) = self._request(
  File "/path/python3.8/site-packages/httplib2/__init__.py", line 1447, in _request
    raise RedirectMissingLocation(
httplib2.error.RedirectMissingLocation: Redirected but the response is missing a Location: header.
N/A% |#                                                                                                                                                                                                |   0.0 s/B

the content of the response from youtube is:

{'content-type': 'text/plain; charset=utf-8', 'x-guploader-uploadid': 'xxxxxxxxxxxxxxxxxxxxxxxxxx', 'range': 'bytes=0-8388607', 'x-range-md5': 'xxxxxxxxxxxxxxxxxxx', 'content-length': '0', 'date': 'Sun, 19 Sep 2021 01:12:21 GMT', 'server': 'UploadServer', 'alt-svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"', 'status': '308'} b''

To Reproduce

The command line run by my python script:

youtube-upload --title="[JDR] Loup-garou: Boston - Ep 31 - Laser Guest 3000" --description="Description:
Quand les lupins se prennent au jeu.

Fiche Épisode:http://blog.rolisteam.org/podcast/

Podcast:http://blog.rolisteam.org/feed/podcast/oneshots
iTunes:https://podcasts.apple.com/fr/podcast/les-chroniques-libres/id1539150834

Si vous voulez nous rejoindre, contacter nous via notre serveur discord.

Liens Utiles:
Twitch: https://www.twitch.tv/rolisteam
Notre discord: https://discord.gg/MrMrQwX

Rolisteam: http://www.rolisteam.org
Supporter le logiciel et la chaîne: https://liberapay.com/Rolisteam/donate" --tags="boston, loup-garou, monde des ténébres, vampire, USA, chronique des ténébres, mdt, lg, les déchus, mage, tribal, jdr, jeux de rôle, role, dice, dés, jeu de rôle, role, rôle, loup" --default-language=fr --default-audio-language=fr --client-secrets=/path/02_uploadYT/client_secret.json --playlist Boston --thumbnail /path/werewolf/31/thumb.jpg /path/Games/werewolf/31/normalized-video-episode_31.mp4

I changed path to remove details of my computer, but paths to file are good.

Expected behavior To get the video uploaded

Desktop (please complete the following information):