Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I believe you need to use the 2.0 version of the YouTube API, and the various language-specific APIs, including Python, only provide 1.0 versions at this time. But it's not hard to update a video to change access control with a bare-metal 2.0 operation, even if everything else you're doing through a language-specific API. <a href="http://code.google.com/apis/youtube/2.0/developers_guide_protocol_updating_and_deleting_videos.html" rel="nofollow noreferrer">The docs</a> (for the 2.0 API) explain:</p> <blockquote> <p>To update a video, send an HTTP PUT request to the URL identified in the video entry's <code>&lt;link&gt;</code> tag where the <strong>rel</strong> attribute value is <strong>edit</strong>:</p> </blockquote> <pre><code>&lt;link rel='edit' type='application/atom+xml' href='http://gdata.youtube.com/feeds/api/users/USER_ID/uploads/VIDEO_ID'&gt; </code></pre> <blockquote> <p>The body of the PUT request is an Atom XML entry that contains information about the video. You can include any of the following elements and their subtags in your request. Required elements are marked with an asterisk (*).</p> </blockquote> <pre><code>media:title* media:description* media:category* media:keywords* yt:accessControl yt:location yt:private georss:where </code></pre> <blockquote> <p>Note that excluding an element will delete the information that already exists for that video.</p> </blockquote> <p>...so you'll have to repeat some of the info you already gave on uploading (to avoid deleting that information) in order to be able to add <code>yt:accessControl</code> elements.</p> <p>The docs for uploading have a <a href="http://code.google.com/apis/youtube/2.0/developers_guide_protocol_uploading_videos.html" rel="nofollow noreferrer">complete example</a> of the headers, <code>multipart-related</code> formatting, and XML you would be sending (with the addition of the access control tags as per <a href="http://code.google.com/apis/youtube/2.0/developers_guide_protocol_uploading_videos.html#Setting_Access_Controls" rel="nofollow noreferrer">this part</a> of the docs) -- but the example is a <code>POST</code>, not a <code>PUT</code>, because it's uploading a video, not changing its info (and access control). To send HTTP methods other than GET and POST via Python's standard library, use <a href="http://docs.python.org/library/httplib.html?highlight=httplib#httpconnection-objects" rel="nofollow noreferrer">httplib</a>: make an <code>HTTPConnection</code> and then call its <a href="http://docs.python.org/library/httplib.html?highlight=httplib#httplib.HTTPConnection.request" rel="nofollow noreferrer">request</a> method with <code>PUT</code> as the first argument, then URL (the part <em>after</em> the host, see the examples at the end of this section of the Python online docs), body (the part that in the example in the docs for the Youtube 2.0 API starts</p> <pre><code>--f93dcbA3 Content-Type: application/atom+xml; charset=UTF-8 &lt;?xml version="1.0"?&gt; &lt;entry xmlns="http://www.w3.org/2005/Atom" </code></pre> <p>and finally the headers).</p> <p>Yes, it's definitely <em>not</em> quite as handy as the GData API, but, until the latter is updated to support the 2.0 API functionality, I do suspect it's the best way. The main alternative would be to tweak the Python API sources (found <a href="http://gdata-python-client.googlecode.com/svn/trunk/src/gdata/youtube/" rel="nofollow noreferrer">here</a>) to add the 2.0 bit of functionality you require, but, offhand, that seems to me to be even more work.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload