[Chicago] help code new youtube upload

Carl Karsten carl at personnelware.com
Thu Jan 16 21:59:18 CET 2014


I need help.

> So seems I should throw out this whole thing and rewrite it using:
> https://developers.google.com/youtube/v3/

I can't figure out how to run the samples.

Reading the docs, looking at the sample code, and playing around at
the >>> prompt; I cant figure out how to authenticate.

Here are the obvious starting places:

https://developers.google.com/youtube/v3/
https://developers.google.com/api-client-library/python/

The two samples I am failing to get to work:
https://code.google.com/p/youtube-api-samples/source/browse/samples/python/upload_video.py
https://github.com/youtube/yt-samples-python/blob/master/simple_upload.py

You will need to get credentials from
https://code.google.com/apis/console/#:access

If someone can figure out how to setup a test account that isn't
linked to personal accounts so we can share it with random people on
the internet, that woujld be great.

The milestone I am shooting for:
A single .py that when run will upload an mp4 and print out the youtube URL.
It should be dirt simple.  All the values should be hard coded, with
the exception of secrets (like password or private key.)

Here is the same thing that I use to uplaod to the Rackspace CDN:
https://github.com/CarlFK/veyepar/blob/master/dj/scripts/rax_uploader.py

If someone can take a stab at this and tell me how far they got,

On Mon, Jan 6, 2014 at 4:06 AM, Carl Karsten <carl at personnelware.com> wrote:
> I would be ecstatic if you used me code!
>
> But..
> This just in, which kinda trows a wrench in my excitement:
>
> My code, youtube_uploader.py is really just a wrapper around
>
> https://developers.google.com/gdata/
>
> so that the rest of the system has a fairly consistent interface to
> various hosts, and I have some simple code to dev/test/debug.
>
> But if you look at the top of the gdata/ url:
> """
> Warning: Most newer Google APIs are not Google Data APIs. The Google
> Data APIs documentation applies only to the older APIs that are listed
> in the Google Data APIs directory. For information about a specific
> new API, see that API's documentation. For information about
> authorizing requests with a newer API, see Google Accounts
> Authentication and Authorization.
> """
>
> So seems I should throw out this whole thing and rewrite it using:
> https://developers.google.com/youtube/v3/
>
> That will be what I put my next effort into, so if you can do
> something with that, it will be more
> helpful.
>
> The interface the rest of the system expects is what you see in
>
> def test_upload():
> and
> def test_set_pub():
>
> Here is where it is used:
>
> https://github.com/CarlFK/veyepar/blob/master/dj/scripts/post_yt.py#L153
>
> https://github.com/CarlFK/veyepar/blob/master/dj/scripts/mk_public.py#L60
>
> yes, pw.py is user/pw
> https://github.com/CarlFK/veyepar/blob/master/dj/scripts/sample_pw.py
>
> And maybe I should to this try/except thing to make it easier:
> like I do here:
> https://github.com/CarlFK/veyepar/blob/master/dj/scripts/rax_uploader.py#L24
>
> it is 4am.. I need to sleep before my head falls on my keyboard.
> So look for that in a few hours ;)
>
>
> On Sun, Jan 5, 2014 at 8:33 PM, sheila miguez <shekay at pobox.com> wrote:
>> I'm +1 for a talk from you.
>>
>> On Jan 5, 2014 8:25 PM, "Nick Bennett" <nick at goggl.es> wrote:
>>>
>>> All that I have learned about Python, I have learned through trial and
>>> error in IPython. I usually get the feel of an API or new module first in
>>> the shell, and then I can write code in my editor. I could give a talk on
>>> using an interactive shell to debug code and explore modules, in particular
>>> IPython but the the approach would be similar with others like IDLE or
>>> python or bpython. I introduced my work mentor to it, a purist with a
>>> mechanical keyboard tailored for vim use, and since then he has been using
>>> ipython on most of our Python-based work projects. If that's not a stunning
>>> recommendation, I don't know what is one.
>>>
>>> Let's call the talk "Getting a feel for the code" and in it I will talk
>>> about using Python REPL shells including python, IPython, and bpython. I'll
>>> talk about getting access to a Python REPL quickly and easily when in need,
>>> to appeal to a wider audience. Perhaps you see something interesting on
>>> Github and you want to see how it would work, but you're not a programmer
>>> yet and/or don't have a Python environment at your fingertips. I'll talk
>>> about PythonAnywhere, along with a blurb about getting an EC2 instance
>>> going. Could I use your code, Carl, as an example in the presentation?
>>>
>>> Thoughts?
>>>
>>>
>>> On Sun, Jan 5, 2014 at 6:08 PM, Carl Karsten <carl at personnelware.com>
>>> wrote:
>>>>
>>>> On Sun, Jan 5, 2014 at 5:48 PM, Nick Bennett <nick at goggl.es> wrote:
>>>> > by writing a Python script to get the pairwise distances between Divvy
>>>> > bike
>>>> > stations from the Google Maps API using "by the bike" distances.
>>>>
>>>> I would like something about this.  pretty much anything.
>>>> I use various google API stuff successfully, but it is almost a
>>>> surprise to me that things work.
>>>> and then when they don't work, that is also a surprise.
>>>> I think my main problem is I don't have a clue how to debug this
>>>> stuff, and I don't have a good feel for how to think about it.
>>>>
>>>> Like this code worked for over a year:
>>>>
>>>> https://github.com/CarlFK/veyepar/blob/master/dj/scripts/youtube_uploader.py#L144
>>>>
>>>> A month or so ago stopped working.  It doesn't error, it just doesn't
>>>> give the same results it used to. (it should flip a youtube video from
>>>> unlisted to public.) (if anyone wants to hack on this, that one .py
>>>> should run on its own and it should be easy to get the creds setup so
>>>> you can test it on your own account, or set up a test account)
>>>>
>>>> I want that fixed, and I want a clue how one goes about figuring out
>>>> what is going on.
>>>>
>>>> I have also written code to talk to a goog spread sheet and calendar,
>>>> same feeling of uncertainty.
>>>>
>>>> So anything in this area should help.
>>>>
>>>> --
>>>> Carl K
>>>> _______________________________________________
>>>> Chicago mailing list
>>>> Chicago at python.org
>>>> https://mail.python.org/mailman/listinfo/chicago
>>>
>>>
>>>
>>> _______________________________________________
>>> Chicago mailing list
>>> Chicago at python.org
>>> https://mail.python.org/mailman/listinfo/chicago
>>>
>>
>> _______________________________________________
>> Chicago mailing list
>> Chicago at python.org
>> https://mail.python.org/mailman/listinfo/chicago
>>
>
>
>
> --
> Carl K



-- 
Carl K


More information about the Chicago mailing list