Giter VIP home page Giter VIP logo

youtube-upload's Introduction

Introduction

Command-line script to upload videos to Youtube using theYoutube APIv3. It should work on any platform (GNU/Linux, BSD, OS X, Windows, ...) that runs Python.

Dependencies

Check if your operating system provides those packages (check also those deb/rpm/mac files), otherwise install them with pip:

$ sudo pip install --upgrade google-api-python-client oauth2client progressbar2

Install

$ wget https://github.com/tokland/youtube-upload/archive/master.zip
$ unzip master.zip
$ cd youtube-upload-master
$ sudo python setup.py install

Or run directly from sources:

$ cd youtube-upload-master
$ PYTHONPATH=. python bin/youtube-upload ...

Setup

You'll see that there is no email/password options. Instead, the Youtube API uses OAuth 2.0 to authenticate the upload. The first time you try to upload a video, you will be asked to follow a URL in your browser to get an authentication token. If you have multiple channels for the logged in user, you will also be asked to pick which one you want to upload the videos to. You can use multiple credentials, just use the option --credentials-file. Also, check the token expiration policies.

The package used to include a default client_secrets.json file. It does not work anymore, Google has revoked it. So you now must create and use your own OAuth 2.0 file, it's a free service. Steps:

  • Go to the Google console.
  • Create project.
  • Side menu: APIs & auth -> APIs
  • Top menu: Enabled API(s): Enable all Youtube APIs.
  • Side menu: APIs & auth -> Credentials.
  • Create a Client ID: Add credentials -> OAuth 2.0 Client ID -> Other -> Name: youtube-upload -> Create -> OK
  • Download JSON: Under the section "OAuth 2.0 client IDs". Save the file to your local system.
  • Use this JSON as your credentials file: --client-secrets=CLIENT_SECRETS or copy it to ~/client_secrets.json.

Note: client_secrets.json is a file you can download from the developer console, the credentials file is something auto generated after the first time the script is run and the google account sign in is followed, the file is stored at ~/.youtube-upload-credentials.json.

Examples

  • Upload a video (a valid ~/.client_secrets.json should exist, check the Setup section):
$ youtube-upload --title="A.S. Mutter" anne_sophie_mutter.flv
pxzZ-fYjeYs
  • Upload a video with extra metadata, with your own client secrets and credentials file, and to a playlist (if not found, it will be created):
$ 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="my_client_secrets.json" \
  --credentials-file="my_credentials.json" \
  --playlist="My favorite music" \
  --embeddable=True|False \
  anne_sophie_mutter.flv
tx2Zb-145Yz

Other extra medata available :

--privacy (public | unlisted | private)  
--publish-at (YYYY-MM-DDThh:mm:ss.sZ)  
--location (latitude=VAL,longitude=VAL[,altitude=VAL])  
--thumbnail (string)  
  • Upload a video using a browser GUI to authenticate:
$ youtube-upload --title="A.S. Mutter" --auth-browser anne_sophie_mutter.flv
  • Split a video with ffmpeg

If your video is too big or too long for Youtube limits, split it before uploading:

$ bash examples/split_video_for_youtube.sh video.avi
video.part1.avi
video.part2.avi
video.part3.avi
  • Use a HTTP proxy

Set environment variables http_proxy and https_proxy:

$ export http_proxy=http://user:password@host:port
$ export https_proxy=$http_proxy
$ youtube-upload ....

Get available categories

  • Search "youtube categories" -> youtube.videoCategories.list
  • This bring you to youtube.videoCategories.list service
  • part: id,snippet
  • regionCode: es (2 letter code of your country)
  • Authorize and execute

And see the JSON response below. Note that categories with the attribute assignable equal to false cannot be used.

Using shoogle:

$ shoogle execute --client-secret-file client_secret.json \
                  youtube:v3.videoCategories.list <(echo '{"part": "id,snippet", "regionCode": "es"}')  | 
    jq ".items[] | select(.snippet.assignable) | {id: .id, title: .snippet.title}"

Notes for developers

Alternatives

  • shoogle can send requests to any Google API service, so it can be used not only to upload videos, but also to perform any operation regarding the Youtube API.

  • youtubeuploader uploads videos to Youtube from local disk or from the web. It also provides rate-limited uploads.

More

Feedback

  • Donations.
  • If you find a bug, open an issue.
  • If you want a new feature to be added, you'll have to send a pull request (or find a programmer to do it for you), currently I am not adding new features.

youtube-upload's People

Contributors

abobov avatar akordowski avatar andir avatar bannerman avatar bene81 avatar coddingtonbear avatar darbychang avatar davidventura avatar djidiouf avatar goblenus avatar jvuori avatar kootsoop avatar lamby avatar leo7654 avatar littlelama avatar lus1n avatar mhkrebs avatar nojvek avatar phihag avatar pigletto avatar sbma44 avatar skylion007 avatar sybrenstuvel avatar tokland avatar tsgoff avatar vobruba-martin avatar zepalmer avatar zulc22 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

youtube-upload's Issues

Retryable error x/10: ResumableUploadError

Trying to upload a video
youtube-upload --category="Short Movies" --title="Timelapse 150515" /mnt/video/Timelapse/timelapse-150515.mp4
All I get is
Retryable error 1/10: ResumableUploadError. Waiting 1.04799341928 seconds
Retryable error 2/10: ResumableUploadError. Waiting 0.998596183914 seconds
Retryable error 3/10: ResumableUploadError. Waiting 6.92854485734 seconds
Retryable error 4/10: ResumableUploadError. Waiting 2.02846262772 seconds
Retryable error 5/10: ResumableUploadError. Waiting 5.41348200998 seconds
Retryable error 6/10: ResumableUploadError. Waiting 15.2127477185 seconds
Retryable error 7/10: ResumableUploadError. Waiting 50.0016125671 seconds
...
Retryable error 10.10;

Nothing gets uploaded.

ImportError: No module named playlists

Hello dir ,

Thanks for your work last branch show error :
Traceback (most recent call last):
File "/usr/local/bin/youtube-upload", line 30, in
import playlists
ImportError: No module named playlists

Videos longer than 15'

Hi:

thanks for the script. I have noticed that I can upload videos longer than 15 minutes via the web interface, but the script leads to youtube displaying the error message that " This video has been removed because it is too long. "

The log did not show anything strange:

youtube-upload --title='LLL' Freitag_1.avi
Using client secrets: /home/XXX/.client_secrets.json
Using credentials file: /home/XXX/.youtube-upload-credentials.json
Start upload: Freitag_1.avi
100% |####################################################################################################################| Time: 0:00:39 10.05 MB/s
Video URL: https://www.youtube.com/watch?v=R6X6ssrCZPk
R6X6ssrCZPk

I am using the same account, of course, I have enabled the long-movies option and I have managed to upload a 45 minutes one without an issue using the web interface.

Thanks,

Pau

Upload from a FIFO

Is it possible to upload from a FIFO made by mkfifo?
I tryied only the non-git version, but it fails when uploading from a FIFO.

No such option "unlisted" / "private"

How can I upload videos with private or unlisted settings?

I could not find in help and in code. In previous version there was an option "--unlisted" or "--private" but now it just no longer works for me.

python: abrt: detected unhandled Python exception in /usr/bin/youtube-upload

Sometime the upload was failed due to python crash

Jan 27 16:11:44 user python: abrt: detected unhandled Python exception in /usr/bin/youtube-upload
Jan 27 16:11:44 user abrtd: dumpsocket: New client connected
Jan 27 16:11:44 user abrtd: dumpsocket: Saved Python crash dump of pid 28877 to /var/spool/abrt/pyhook-1422349904-28877
Jan 27 16:11:44 user abrtd: dumpsocket: Socket client disconnected
Jan 27 16:11:44 user abrtd: Directory 'pyhook-1422349904-28877' creation detected
Jan 27 16:11:44 user abrtd: Executable '/usr/bin/youtube-upload' doesn't belong to any package

Jan 27 16:11:44 user abrtd: Corrupted or bad crash /var/spool/abrt/pyhook-1422349904-28877 (res:4), deleting

Feature request in 0.7.3 youtube-upload

0.7.3 youtube-upload with
2.0.18 gdata python client
Youtube API have a lot of features that not include in youtube-upload.
I need to bulk update my playlists, set Video language option for video,...

You should write a document about how to implement Youtube API features in to youtube-upload via source code.
With this, user can create they owns features then can do "Pull request", you improve it and integrate into your code.
Rather than play alone :)

Dear,

Very slow upload speed (chunk size related)

Hi
I suppose I have a high ping to youtube, the default 161024 chunk size ends up with ~30kB/s uploaded. using 3001024 maxes up my upload at about 375kB/s
Maybe this should be a config ?

Progress bar

I think that for the upload is useful a progress bar about the upload.

upload video but got ResumableUploadError with HttpError 401 "Unauthorized"

youtube-upload --title="test" --location="=" video.mp4

Traceback (most recent call last):
  File "/usr/local/bin/youtube-upload", line 164, in <module>
    sys.exit(lib.catch_exceptions(EXIT_CODES, main, sys.argv[1:]))
  File "/Library/Python/2.7/site-packages/youtube_upload/lib.py", line 21, in catch_exceptions
    fun(*args, **kwargs)
  File "/usr/local/bin/youtube-upload", line 161, in main
    run_main(parser, options, args)
  File "/usr/local/bin/youtube-upload", line 124, in run_main
    video_id = upload_video(youtube, options, video_path, len(args), index)
  File "/usr/local/bin/youtube-upload", line 100, in upload_video
    progress_callback=progress.callback, chunksize=16*1024)
  File "/Library/Python/2.7/site-packages/youtube_upload/upload_video.py", line 58, in upload
    return _upload_to_request(request, progress_callback)
  File "/Library/Python/2.7/site-packages/youtube_upload/upload_video.py", line 24, in _wrapper
    return f(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/youtube_upload/upload_video.py", line 43, in _upload_to_request
    status, response = request.next_chunk()
  File "/Library/Python/2.7/site-packages/oauth2client-1.4.6-py2.7.egg/oauth2client/util.py", line 135, in positional_wrapper
  File "/Library/Python/2.7/site-packages/google_api_python_client-1.3.1-py2.7.egg/googleapiclient/http.py", line 808, in next_chunk
googleapiclient.errors.ResumableUploadError: <HttpError 401 "Unauthorized">

terminating with exception KeyError: '_module'

Hi, the script is terminating with an exception, I think something having to do with the getting credentials or the credentials file. Any help would be greatly appreciated
I'm running the script with this input
python main.py --title="test" --client-secrets=/Users/willrachofsky/youtube-upload/client_secrets.json --credentials-file=/Users/willrachofsky/youtube-upload/credentials_file.json /Users/willrachofsky/Movies/testforyoutube.mp4
and getting this output
Using client secrets: /Users/willrachofsky/youtube-upload/client_secrets.json
Using credentials file: /Users/willrachofsky/youtube-upload/credentials_file.json
Traceback (most recent call last):
File "main.py", line 189, in
sys.exit(lib.catch_exceptions(EXIT_CODES, main, sys.argv[1:]))
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/youtube_upload/lib.py", line 37, in catch_exceptions
fun(_args, *_kwargs)
File "main.py", line 186, in main
run_main(parser, options, args)
File "main.py", line 141, in run_main
get_code_callback=get_code_callback)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/youtube_upload/auth/init.py", line 39, in get_resource
credentials = _get_credentials(flow, storage, get_code_callback)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/youtube_upload/auth/init.py", line 28, in _get_credentials
existing_credentials = storage.get()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/oauth2client-1.4.11-py2.7.egg/oauth2client/client.py", line 374, in get
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/oauth2client-1.4.11-py2.7.egg/oauth2client/file.py", line 79, in locked_get
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/oauth2client-1.4.11-py2.7.egg/oauth2client/client.py", line 281, in new_from_json
KeyError: '_module'

Warn user if title > 100 chars

Apparently youtube doesn't accept video upload with title > 100chars. Currently, youtube-upload fails with

Retryable error 1/10: ResumableUploadError. Waiting 0.666298561664 seconds

The message could be more explicit.

Progressbar error

Hello, I have got this error when trying to upload :

root@hostname:/youtube-upload# /youtube-upload/bin/youtube-upload -t DESCRIPTION -d d /clip.mp4
Using client secrets: /usr/local/share/youtube_upload/client_secrets.json
Using credentials file: /root/.youtube-upload-credentials.json
Start upload: /clip.mp4 (DESCRIPTION)
Traceback (most recent call last):
  File "/youtube-upload/bin/youtube-upload", line 192, in <module>
    sys.exit(lib.catch_exceptions(EXIT_CODES, main, sys.argv[1:]))
  File "/usr/local/lib/python2.7/dist-packages/youtube_upload/lib.py", line 37, in catch_exceptions
    fun(*args, **kwargs)
  File "/youtube-upload/bin/youtube-upload", line 189, in main
    run_main(parser, options, args)
  File "/youtube-upload/bin/youtube-upload", line 146, in run_main
    video_id = upload_video(youtube, options, video_path, len(args), index)
  File "/youtube-upload/bin/youtube-upload", line 117, in upload_video
    progress.finish()
  File "/usr/local/lib/python2.7/dist-packages/progressbar/__init__.py", line 320, in finish
    self.update(self.maxval)
  File "/usr/local/lib/python2.7/dist-packages/progressbar/__init__.py", line 276, in update
    if not self._need_update(): return
  File "/usr/local/lib/python2.7/dist-packages/progressbar/__init__.py", line 251, in _need_update
    if self.currval >= self.next_update or self.finished: return True
AttributeError: next_update

Crash in oauth2client/client.py", line 274, in new_from_json

Hi! Just installed, download json by instructions and got this:

Using client secrets: /usr/local/share/youtube_upload/client_secrets.json
Using credentials file: /home/xor/google.json
Traceback (most recent call last):
  File "/usr/local/bin/youtube-upload", line 181, in <module>
    sys.exit(lib.catch_exceptions(EXIT_CODES, main, sys.argv[1:]))
  File "/usr/local/lib/python2.7/dist-packages/youtube_upload/lib.py", line 37, in catch_exceptions
    fun(*args, **kwargs)
  File "/usr/local/bin/youtube-upload", line 178, in main
    run_main(parser, options, args)
  File "/usr/local/bin/youtube-upload", line 133, in run_main
    get_code_callback=get_code_callback)
  File "/usr/local/lib/python2.7/dist-packages/youtube_upload/auth/__init__.py", line 39, in get_resource
    credentials = _get_credentials(flow, storage, get_code_callback)
  File "/usr/local/lib/python2.7/dist-packages/youtube_upload/auth/__init__.py", line 28, in _get_credentials
    existing_credentials = storage.get()
  File "/usr/local/lib/python2.7/dist-packages/oauth2client-1.4.7-py2.7.egg/oauth2client/client.py", line 367, in get
    return self.locked_get()
  File "/usr/local/lib/python2.7/dist-packages/oauth2client-1.4.7-py2.7.egg/oauth2client/file.py", line 79, in locked_get
    credentials = Credentials.new_from_json(content)
  File "/usr/local/lib/python2.7/dist-packages/oauth2client-1.4.7-py2.7.egg/oauth2client/client.py", line 274, in new_from_json
    module = data['_module']
KeyError: '_module'

-bash: --description= : command not found

Hello

I installed everything, ran a test and managed to upload a video with the simple method (just the tile)

Now, when I try to upload with all meta, I'm getting an error.

I don't know what went wrong.

My query

youtube-upload --title="How To Do: Dumbbell Twist - Russian Standing | Ab Workout Exercise Video | Fitway"
--description="Stand straight with feet should with apart. Hold the dumbbell out in front at waist"
--category=#Lifestyle
--tags="fitness,workout,exercises,gym,app,android,iPhone"
--client-secrets=my_client_secrets.json
--credentials-file=my_credentials.json
dag_01_05.mp4

Error message:

-bash: --description=Stand straight with feet should with apart. Hold the dumbbell out in front at waist: command not found

Anyone has an idea?

Thanks

"Classics" CategoryID is not valid

Using category ID: Classics (33)
Start upload: Day9/Day9/Day9.mov (Day9 [1/5])
[RequestError] Server response was: {
 "error": {
  "errors": [
   {
    "domain": "youtube.video",
    "reason": "invalidCategoryId",
    "message": "Bad Request",
    "locationType": "other",
    "location": "body.snippet.categoryId"
   }
  ],
  "code": 400,
  "message": "Bad Request"
 }
}

Dowsn't work with Windows 8

Tried using CMD and Powershell. I ran and installed dependencies and then install this and youtube-upload doesn't work. All I get is an error in PS, CMD, and Python. There are no instructions here for windows it seems :(.

PS:

youtube-upload : The term 'youtube-upload' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At line:1 char:1

youtube-upload
--------------------------
CategoryInfo : ObjectNotFound: (youtube-upload:String) [], CommandNotFoundException
FullyQualifiedErrorId : CommandNotFoundException`

CMD:

'youtube-upload' is not recognized as an internal or external command, operable program or batch file.`

Py:

Traceback (most recent call last):
File "", line 1, in 
NameError: name 'youtube' is not defined

Check for upload status sometimes fails

Traceback (most recent call last):
File "/usr/bin/youtube-upload", line 519, in
sys.exit(catch_exceptions(EXIT_CODES, main, sys.argv[1:]))
File "/usr/bin/youtube-upload", line 111, in catch_exceptions
fun(_args, *_kwargs)
File "/usr/bin/youtube-upload", line 516, in main
run_main(parser, options, args)
File "/usr/bin/youtube-upload", line 449, in run_main
url = upload_video(youtube, options, video_path, len(args), index)
File "/usr/bin/youtube-upload", line 379, in upload_video
wait_processing(youtube, video_id)
File "/usr/bin/youtube-upload", line 325, in wait_processing
response = youtube_obj.check_upload_status(video_id)
File "/usr/bin/youtube-upload", line 254, in check_upload_status
return self.service.CheckUploadStatus(video_id=video_id)
File "/usr/lib/python2.7/site-packages/gdata/youtube/service.py", line 687, in CheckUploadStatus
video_entry = self.GetYouTubeVideoEntry(video_id=video_id)
File "/usr/lib/python2.7/site-packages/gdata/youtube/service.py", line 210, in GetYouTubeVideoEntry
return self.Get(uri, converter=gdata.youtube.YouTubeVideoEntryFromString)
File "/usr/lib/python2.7/site-packages/gdata/service.py", line 1108, in Get
'reason': server_response.reason, 'body': result_body}
gdata.service.RequestError: {'status': 503, 'body': 'Service Unavailable', 'reason': 'Service Unavailable'}

UnicodeDecodeError: 'ascii' codec can't decode byte

Hello, I have got this error when upload is triggered by cronjob (user: root):
File "/usr/bin/youtube-upload", line 191, in
sys.exit(lib.catch_exceptions(EXIT_CODES, main, sys.argv[1:]))
File "/usr/lib/python2.6/site-packages/youtube_upload/lib.py", line 35, in catch_exceptions
fun(_args, *_kwargs)
File "/usr/bin/youtube-upload", line 188, in main
run_main(parser, options, args)
File "/usr/bin/youtube-upload", line 147, in run_main
video_id = upload_video(youtube, options, video_path, len(args), index)
File "/usr/bin/youtube-upload", line 90, in upload_video
title = u(options.title)
File "/usr/lib/python2.6/site-packages/youtube_upload/lib.py", line 21, in to_utf8
return s.decode(current).encode("UTF-8") if s and current != "UTF-8" else s
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 24: ordinal not in range(128)

Title, description and tags contain special characters such as "äöüß"... Strangely, when I start the upload-shell-script directly from the console (user: root) there are no problems!!

The following adjustments work for me in both cases with special characters (cronjob, console):
"""Upload video with index (for split videos)."""
u = lib.to_utf8
#title = u(options.title)
title = (options.title)
#description = u(options.description or "").decode("string-escape")
description = (options.description or "").decode("string-escape")
#tags = [u(s.strip()) for s in (options.tags or "").split(",")]
tags = [s.strip() for s in (options.tags or "").split(",")]
#ns = dict(title=u(options.title), n=index+1, total=total_videos
ns = dict(title=(options.title), n=index+1, total=total_videos)
complete_title = \

(Environment: CentOS 6.2, Pyhton 2.6.6)

Thx, Stephan

How to Bulk Upload Video using Youtube-Upload?

I am trying using youtube-upload to upload some videos in a time (bulk), but failed, always asking for Enter verification code: (which is done when using single video upload)

is there any method to bulk upload video using youtube-upload?

thanks

setup.py not installing client_secrets.json

Ran 'sudo python setup.py install'. Script installed but did not create /usr/share/youtube_upload. Manually creating and copy client_secrets.json there fixes error. This is on Ubuntu 14.04 LTS (ami-d05e75b8 in EC2).

Invalid_client

I getting this Error after entering the verification code:

Traceback (most recent call last):
File "/usr/local/bin/youtube-upload", line 164, in
sys.exit(lib.catch_exceptions(EXIT_CODES, main, sys.argv[1:]))
File "/usr/local/lib/python2.7/dist-packages/youtube_upload/lib.py", line 21, in catch_exceptions
fun(_args, *_kwargs)
File "/usr/local/bin/youtube-upload", line 161, in main
run_main(parser, options, args)
File "/usr/local/bin/youtube-upload", line 121, in run_main
youtube = youtube_upload.auth.get_resource(client_secrets, credentials)
File "/usr/local/lib/python2.7/dist-packages/youtube_upload/auth.py", line 40, in get_resource
credentials = _get_credentials(flow, storage, get_code)
File "/usr/local/lib/python2.7/dist-packages/youtube_upload/auth.py", line 32, in _get_credentials
return _get_credentials_interactively(flow, storage, get_code_callback)
File "/usr/local/lib/python2.7/dist-packages/youtube_upload/auth.py", line 21, in _get_credentials_interactively
credential = flow.step2_exchange(code, http=None)
File "/usr/local/lib/python2.7/dist-packages/oauth2client/util.py", line 135, in positional_wrapper
return wrapped(_args, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/oauth2client/client.py", line 196 4, in step2_exchange
raise FlowExchangeError(error_msg)
oauth2client.client.FlowExchangeError: invalid_client

Missing Error handler / Possible bug

I have installed the dependencies using pip. When I want to upload my video I get the following error:

pi@clund-raspi /data/hdd/data_main/03yt/upload/query $ youtube-upload --title="test1" --client-secrets=./userdata.json ./render1.mp4 
Traceback (most recent call last):
  File "/usr/local/bin/youtube-upload", line 23, in <module>
    import apiclient.errors
ImportError: No module named apiclient.errors
pi@clund-raspi /data/hdd/data_main/03yt/upload/query $ ls
render1.mp4  userdata.json
pi@clund-raspi /data/hdd/data_main/03yt/upload/query $ python --version
Python 2.7.3

Idk if this is caused by an error from my side (API key wrong or so) or if this is an issue of yt-upload.

How to set "Video language", "Monitize" field when upload?

= Versions

youtube-upload: 0.7.3
python: 2.7.8
python-gdata: 2.0.18

= Describe the steps (including the command you run) that will reproduce
the problem?

How to set "Video language" field when upload?
It's good to have --language option.
I need "Video language" set to English for all newly upload videos.

One more thing, how to set Monetize settings for video?
Ads settings can be set via Youtube Video Manager, but lack of automation insert Mid-roll ads based on video length.
I hear Gdata API v3 support it.
Please help me!
Dear,

MinhThang's Blog

Upload result "Raw file: Unknown"

In previous version of youtube-upload + API v2 (deprecated), Raw file option alway same with upload file.
But with this version: 0.8 + API v3, "Raw file" of every videos alway are "Unknown".
This property play important role in video SEO ranking.
screenclip

Any workaround, please!

ImportError: No module named apiclient.discovery

I'm trying to run this:
youtube-upload [email protected] --password=pwd --unlisted --category="Autos" --keywords="keyword" --title="title" --description="desc" "movie.avi"

This is the error I get:

Traceback (most recent call last):
  File "/usr/bin/youtube-upload", line 21, in <module>
    import youtube_upload.auth
  File "/usr/lib/python2.7/site-packages/youtube_upload/auth.py", line 4, in <module>
    import apiclient.discovery
ImportError: No module named apiclient.discovery

0.7.3 Works well with the same command.

googleapiclient.errors.ResumableUploadError on attempted upload

youtube-upload --title="TestTitle" --description="TestDescription" TestMovie.avi

Traceback (most recent call last):
  File "/usr/bin/youtube-upload", line 211, in 
    sys.exit(catch_exceptions(EXIT_CODES, main, sys.argv[1:]))
  File "/usr/bin/youtube-upload", line 61, in catch_exceptions
    fun(*args, **kwargs)
  File "/usr/bin/youtube-upload", line 208, in main
    run_main(parser, options, args)
  File "/usr/bin/youtube-upload", line 169, in run_main
    video_id = upload_video(youtube, options, video_path, len(args), index)
  File "/usr/bin/youtube-upload", line 145, in upload_video
    progress_callback=progress.callback, chunksize=16*1024)
  File "/usr/lib/python2.7/site-packages/youtube_upload/upload_video.py", line 10, in upload
    status, response = request.next_chunk()
  File "/usr/lib/python2.7/site-packages/oauth2client-1.4.5-py2.7.egg/oauth2client/util.py", line 135, in positional_wrapper
    return wrapped(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/google_api_python_client-1.3.1-py2.7.egg/googleapiclient/http.py", line 808, in next_chunk
    raise ResumableUploadError(resp, content)
googleapiclient.errors.ResumableUploadError: HttpError 400 "Media type 'None' is not supported. Valid media types: [video/*, application/octet-stream]"

Adding mimetype='application/octet-stream' to the proper location in upload_video.py does work, but I am unsure if it has any negative effects during uploading.

Failed Upload Cancellation

Hello,

It seems that even if an upload fails mid-file YouTube will happily process and publish that which it has received. At this time is there any way I can check for this situation in my scripts which use youtube-upload and ask YouTube to cancel the corresponding processing/publishing? I don't think I get a video ID back as a result if the upload fails.

Getting "Retryable Error" permanently since today

Hi
I've been using this twice a week to upload videos and today it decided to stop working. I cloned git master and it's the same thing. I'm thinking this has to be on youtube's side.
No matter what video I choose to upload I get this:

Using client secrets: /usr/share/youtube_upload/client_secrets.json
Using credentials file: /home/david/.youtube-upload-credentials.json
Start upload: tratcompleto1.mp4 (aaaaaa)
Retryable error 1/10: ResumableUploadError. Waiting 0.0655516964213 seconds
Retryable error 2/10: ResumableUploadError. Waiting 1.42532378912 seconds
Retryable error 3/10: ResumableUploadError. Waiting 2.97410480509 seconds
Retryable error 4/10: ResumableUploadError. Waiting 6.27177218128 seconds
Retryable error 5/10: ResumableUploadError. Waiting 28.9982075691 seconds

I deleted and re-created my credentials, it's the same thing. Same with privacy/no privacy

googleapiclient.errors.ResumableUploadError: <HttpError 401 "Unauthorized">

$ youtube-upload --title="eggs" --location="=" --client-secrets=client_secret.json test.mov

Using client secrets: client_secret.json
Using credentials file: /Users/ytyng/.youtube-upload-credentials.json
Start upload: test.mov (eggs)
Traceback (most recent call last):
File "/Users/ytyng/.virtualenvs/d17/bin/youtube-upload", line 164, in
sys.exit(lib.catch_exceptions(EXIT_CODES, main, sys.argv[1:]))
File "/Users/ytyng/.virtualenvs/d17/lib/python2.7/site-packages/youtube_upload/lib.py", line 21, in catch_exceptions
fun(_args, *_kwargs)
File "/Users/ytyng/.virtualenvs/d17/bin/youtube-upload", line 161, in main
run_main(parser, options, args)
File "/Users/ytyng/.virtualenvs/d17/bin/youtube-upload", line 124, in run_main
video_id = upload_video(youtube, options, video_path, len(args), index)
File "/Users/ytyng/.virtualenvs/d17/bin/youtube-upload", line 100, in upload_video
progress_callback=progress.callback, chunksize=16_1024)
File "/Users/ytyng/.virtualenvs/d17/lib/python2.7/site-packages/youtube_upload/upload_video.py", line 35, in upload
return lib.retriable_exceptions(upload_fun, RETRIABLE_EXCEPTIONS, max_retries=10)
File "/Users/ytyng/.virtualenvs/d17/lib/python2.7/site-packages/youtube_upload/lib.py", line 45, in retriable_exceptions
return fun()
File "/Users/ytyng/.virtualenvs/d17/lib/python2.7/site-packages/youtube_upload/upload_video.py", line 34, in
upload_fun = lambda: _upload_to_request(request, progress_callback)
File "/Users/ytyng/.virtualenvs/d17/lib/python2.7/site-packages/youtube_upload/upload_video.py", line 20, in _upload_to_request
status, response = request.next_chunk()
File "/Users/ytyng/.virtualenvs/d17/lib/python2.7/site-packages/oauth2client/util.py", line 135, in positional_wrapper
return wrapped(_args, **kwargs)
File "/Users/ytyng/.virtualenvs/d17/lib/python2.7/site-packages/googleapiclient/http.py", line 808, in next_chunk
raise ResumableUploadError(resp, content)
googleapiclient.errors.ResumableUploadError: <HttpError 401 "Unauthorized">

Failed (unable to convert video file)

Hello,

I have this error since this morning. I am trying to upload a .mp4 file (I already uploaded a lot of files like that) and the error does not come from the file itself because I can upload it manually..
When I launch the script there are no errors, it gives me the youtube link but the video is unavailable because of "Failed (unable to convert video file)"

Can you help me ?

Thanks !

AttributeError: 'module' object has no attribute 'client'

Apologies if I'm committing a very elementary mistake (I have no experience with Python) but when I install and run the script according to the instructions in the README file, it fails as follows:

$ youtube-upload --title=foo --description=bar --category=Music --client-secrets=mysecrets.json baz.mkv
Using client secrets: mysecrets.json
Using credentials file: /home/psy/.youtube-upload-credentials.json
Traceback (most recent call last):
File "/usr/bin/youtube-upload", line 164, in
sys.exit(lib.catch_exceptions(EXIT_CODES, main, sys.argv[1:]))
File "/usr/lib/python2.7/site-packages/youtube_upload/lib.py", line 21, in catch_exceptions
fun(_args, *_kwargs)
File "/usr/bin/youtube-upload", line 161, in main
run_main(parser, options, args)
File "/usr/bin/youtube-upload", line 121, in run_main
youtube = youtube_upload.auth.get_resource(client_secrets, credentials)
File "/usr/lib/python2.7/site-packages/youtube_upload/auth.py", line 36, in get_resource
get_flow = oauth2client.client.flow_from_clientsecrets
AttributeError: 'module' object has no attribute 'client'

Am I perhaps missing a dependency that's not listed in the instructions?

No module named apiclient.errors

Hi,
I'm a complete newbie and I try to follow your step to upload video on my YouTube Channel and I've got this error :
File "/usr/local/bin/youtube-upload", line 23, in
import apiclient.errors
ImportError: No module named apiclient.errors
Any idea on how to resolve this ? I made something wrong ?
Regards,
Ludovic

Credentials vs Secrets

Hey,

I just try to setup the uploader. In your example you provide --client-secrets and --credentials-file. I can not see the difference.

After setting up API access to my Youtube account I could download the OAuth2 secrets file. It has the similar json structure as the example secrets file in this repository.

Where can I get the credentials file? The Readme docu as a little confusing on this topic as credentials and secrets are used inconsistently.

Can you help?

EOFError: EOF when reading a line

when i run youtube-upload, i give a error

Enter verification code: Traceback (most recent call last):
File "/usr/local/bin/youtube-upload", line 164, in
sys.exit(lib.catch_exceptions(EXIT_CODES, main, sys.argv[1:]))
File "/usr/local/lib/python2.7/dist-packages/youtube_upload/lib.py", line 21, in catch_exceptions
fun(_args, *_kwargs)
File "/usr/local/bin/youtube-upload", line 161, in main
run_main(parser, options, args)
File "/usr/local/bin/youtube-upload", line 121, in run_main
youtube = youtube_upload.auth.get_resource(client_secrets, credentials)
File "/usr/local/lib/python2.7/dist-packages/youtube_upload/auth.py", line 40, in get_resource
credentials = _get_credentials(flow, storage, get_code)
File "/usr/local/lib/python2.7/dist-packages/youtube_upload/auth.py", line 32, in _get_credentials
return _get_credentials_interactively(flow, storage, get_code_callback)
File "/usr/local/lib/python2.7/dist-packages/youtube_upload/auth.py", line 20, in _get_credentials_interactively
code = get_code_callback(authorize_url)
File "/usr/local/lib/python2.7/dist-packages/youtube_upload/auth.py", line 14, in _get_code_from_prompt
return raw_input("Enter verification code: ").strip()
EOFError: EOF when reading a line

help me

No module "googleapiclient.discovery"

After a fresh install on Ubuntu 14.04 I get this error when starting youtube-upload:

"ImportError: No module named apiclient.discovery"

I already tried to install several related packages, with no success so far.

Thank you!

problem with uploading by browsers

Hi i tried to upload by commend line and every thing is good but the problem now is when i tried to use the same commend from browser the code is not working they asked me to Enter verification code
and i didnt get the link for verification
i'm working on php

Is there a way to use proxy only for youtube-upload?

Hi,

Is there a way to use proxy only for youtube-upload and not for other services?
I set proxies with export:
$ export http_proxy=http://user:password@host:port
$ export https_proxy=$http_proxy
And, they does work great, but it's globally, so when I curl or download/upload other stuff to other sites it's very slow. So, maybe, there is a way to use proxy only for youtube-upload? And, I'll be able to use other services without proxy.

Thank you & regards,
Artem

Error running script: No module named apiclient.errors

Hi,
I have a problem with this script. When I run it with youtube-upload, I get
Traceback (most recent call last):
File "/usr/local/bin/youtube-upload", line 23, in
import apiclient.errors
ImportError: No module named apiclient.errors

give title for all my file which are uploading to youtube

Hi is it possible to give title for each file ?
for example the commend line code is
youtube-upload --title="A.S. Mutte" a.mp4 b.mp4 c.mp4 d.mp4
with this commend i upload 4 file to youtube but all of them has the same name A.S. Mutte
what is the commend line that i can define name for each of this files

ValueError: dictionary update sequence element #0 has length 1; 2 is required

youtube-upload --title="Check" Check.avi

Using client secrets: /usr/share/youtube_upload/client_secrets.json
Using credentials file: /home/frank/.youtube-upload-credentials.json
Traceback (most recent call last):
  File "/usr/bin/youtube-upload", line 164, in <module>
    sys.exit(lib.catch_exceptions(EXIT_CODES, main, sys.argv[1:]))
  File "/usr/lib/python2.7/site-packages/youtube_upload/lib.py", line 21, in catch_exceptions
    fun(*args, **kwargs)
  File "/usr/bin/youtube-upload", line 161, in main
    run_main(parser, options, args)
  File "/usr/bin/youtube-upload", line 124, in run_main
    video_id = upload_video(youtube, options, video_path, len(args), index)
  File "/usr/bin/youtube-upload", line 94, in upload_video
    "location": lib.string_to_dict(options.location),
  File "/usr/lib/python2.7/site-packages/youtube_upload/lib.py", line 38, in string_to_dict
    return dict(pair.split("=") for pair in pairs)
ValueError: dictionary update sequence element #0 has length 1; 2 is required

"Add to Playlist" functionality

youtube-upload --help did not show any option to add the new video to a playlist after upload. I am aware the V2 API version of this software had this feature, and that this version upgraded to API V3. Is this feature yet in the software, or planned to be implemented? If not, I may try.

ValueError: zero length field name in format

youtube-upload --title="title" --description="latter"
--location="=" --client-secrets="/volumeUSB1/usbshare1-1/my_client_secrets.json"
--category=Games --tags="tags" "/volumeUSB1/usbshare1-1/bs1.avi";

File "/opt/local/bin/youtube-upload", line 164, in
sys.exit(lib.catch_exceptions(EXIT_CODES, main, sys.argv[1:]))
File "/opt/local/lib/python2.6/site-packages/youtube_upload/lib.py", line 21, in catch_exceptions
fun(_args, *_kwargs)
File "/opt/local/bin/youtube-upload", line 161, in main
run_main(parser, options, args)
File "/opt/local/bin/youtube-upload", line 119, in run_main
debug("Using client secrets: {}".format(client_secrets))
ValueError: zero length field name in format

socket.error: [Errno 54] Connection reset by peer

I'm currently facing this problem, this will happen in some video when batch uploading. Anything i can do?
Traceback (most recent call last):
File "/usr/local/bin/youtube-upload", line 5, in
main.run()
File "/Library/Python/2.7/site-packages/youtube_upload/main.py", line 214, in run
sys.exit(lib.catch_exceptions(EXIT_CODES, main, sys.argv[1:]))
File "/Library/Python/2.7/site-packages/youtube_upload/lib.py", line 35, in catch_exceptions
fun(_args, *_kwargs)
File "/Library/Python/2.7/site-packages/youtube_upload/main.py", line 211, in main
run_main(parser, options, args)
File "/Library/Python/2.7/site-packages/youtube_upload/main.py", line 153, in run_main
video_id = upload_youtube_video(youtube, options, video_path, len(args), index)
File "/Library/Python/2.7/site-packages/youtube_upload/main.py", line 121, in upload_youtube_video
request_body, progress_callback=progress.callback)
File "/Library/Python/2.7/site-packages/youtube_upload/upload_video.py", line 37, in upload
RETRIABLE_EXCEPTIONS, max_retries=max_retries)
File "/Library/Python/2.7/site-packages/youtube_upload/lib.py", line 71, in retriable_exceptions
raise exc
socket.error: [Errno 54] Connection reset by peer

Script does not start

Trying to upload video, getting the following error:

[root@dwarkin youtube]# youtube-upload --title="aa" --credentials-file=/data/yt_secret/client_secret.json Full_House_anons_21_18.05_aysor.mov.mp4
Using client secrets: /usr/share/youtube_upload/client_secrets.json
Using credentials file: /data/yt_secret/client_secret.json
Traceback (most recent call last):
File "/usr/bin/youtube-upload", line 181, in
sys.exit(lib.catch_exceptions(EXIT_CODES, main, sys.argv[1:]))
File "/usr/lib/python2.6/site-packages/youtube_upload/lib.py", line 37, in catch_exceptions
fun(_args, *_kwargs)
File "/usr/bin/youtube-upload", line 178, in main
run_main(parser, options, args)
File "/usr/bin/youtube-upload", line 133, in run_main
get_code_callback=get_code_callback)
File "/usr/lib/python2.6/site-packages/youtube_upload/auth/init.py", line 39, in get_resource
credentials = _get_credentials(flow, storage, get_code_callback)
File "/usr/lib/python2.6/site-packages/youtube_upload/auth/init.py", line 28, in _get_credentials
existing_credentials = storage.get()
File "/usr/lib/python2.6/site-packages/oauth2client/client.py", line 374, in get
return self.locked_get()
File "/usr/lib/python2.6/site-packages/oauth2client/file.py", line 79, in locked_get
credentials = Credentials.new_from_json(content)
File "/usr/lib/python2.6/site-packages/oauth2client/client.py", line 281, in new_from_json
module = data['_module']
KeyError: '_module'
[root@dwarkin youtube]#

OS: Centos 6.6
Installed according the README.md
I think, that I've missed something during the installation.

Thank you.

Error running with any argument ('module' object has no attribute 'openssl_md_meth_names')

youtube-dl (2014.12.3)
Python 2.7.9

I've used this program successfully before. Recently updated from Python 2.7.8 to Python 2.7.9, so I'm not sure if that's the issue.

Tried this as a shot in the dark, but no effect.

$ youtube-upload somefile.mpg
Traceback (most recent call last):
  File "/usr/local/bin/youtube-upload", line 49, in <module>
    import gdata.service
  File "/Library/Python/2.7/site-packages/gdata/service.py", line 76, in <module>
    import atom.service
  File "/Library/Python/2.7/site-packages/atom/service.py", line 35, in <module>
    import atom.http
  File "/Library/Python/2.7/site-packages/atom/http.py", line 40, in <module>
    import httplib
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 79, in <module>
    import mimetools
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/mimetools.py", line 6, in <module>
    import tempfile
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tempfile.py", line 35, in <module>
    from random import Random as _Random
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/random.py", line 49, in <module>
    import hashlib as _hashlib
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/hashlib.py", line 138, in <module>
    _hashlib.openssl_md_meth_names)
AttributeError: 'module' object has no attribute 'openssl_md_meth_names'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.