tokland / youtube-upload

Upload videos to Youtube from the command line
2.09k stars 467 forks source link

Is this script working? - sys.excepthook is missing #296

Open agiz opened 4 years ago

agiz commented 4 years ago

I'm CS MSc and I can't get this to work.

First of all, there is no word about OAuth consent screen. Does user type has to be external or internal? Internal always gives 403 unauthorised so I guess external is the only option here.

Then I guess you have to create Desktop oauth2 credentials and download client_secrets.json file.

ok, install in root environment to avoid the hustle (why??) and finally run the script

youtube-upload \
  --title="A.S. Mutter" \
  --description="A.S. Mutter plays Beethoven" \
  --category="Music" \
  --tags="mutter, beethoven" \
  --recording-date="2011-03-10T15:32:17.0Z" \
  --default-language="en" \
  --default-audio-language="en" \
  --client-secrets="client_secrets.json" \
  --playlist="My favorite music" \
  --embeddable=True|False \
  --privacy=private \
  --auth-browser \
  test.mp4
Using client secrets: client_secrets.json
Using credentials file: /Users/foo/.youtube-upload-credentials.json
/usr/local/lib/python2.7/site-packages/oauth2client/_helpers.py:255: UserWarning: Cannot access /Users/foo/.youtube-upload-credentials.json: No such file or directory
  warnings.warn(_MISSING_FILE_MESSAGE.format(filename))
Check this link in your browser: https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fyoutube.upload+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fyoutube&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&client_id=785000153101-2disbs2hvhc0h06av8m5huom65m0dqt5.apps.googleusercontent.com&access_type=offline

The url takes you to confirm and make some exceptions and finally this screen:

Sign in
Please copy this code, switch to your application and paste it there:
<long string>

Copy and paste this string back to the app(?)

Using client secrets: client_secrets.json
Using credentials file: /Users/foo/.youtube-upload-credentials.json
/usr/local/lib/python2.7/site-packages/oauth2client/_helpers.py:255: UserWarning: Cannot access /Users/foo/.youtube-upload-credentials.json: No such file or directory
  warnings.warn(_MISSING_FILE_MESSAGE.format(filename))
Check this link in your browser: https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fyoutube.upload+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fyoutube&redirect_uri=urn%3Aietf%3Awg%3Aoauth%3A2.0%3Aoob&response_type=code&client_id=785000153101-2disbs2hvhc0h06av8m5huom65m0dqt5.apps.googleusercontent.com&access_type=offline
<long string>
close failed in file object destructor:
sys.excepthook is missing
lost sys.stderr

Running it for the second time with credentials.json file already generated. Result - nothing happesn:

youtube-upload \
  --title="A.S. Mutter" \
  --description="A.S. Mutter plays Beethoven" \
  --category="Music" \
  --tags="mutter, beethoven" \
  --recording-date="2011-03-10T15:32:17.0Z" \
  --default-language="en" \
  --default-audio-language="en" \
  --client-secrets="client_secrets_desktop.json" \
  --credentials-file="credentials.json" \
  --playlist="My favorite music" \
  --embeddable=True|False \
  test.mp4

Using client secrets: client_secrets_desktop.json
Using credentials file: credentials.json
Adamatbi commented 2 years ago

Have you found a solution to this problem? I'm running into the same issue