Engineering and Developers Blog
What's happening with engineering and developers at YouTube
YouTube, Google+, the API, and You
Thursday, March 15, 2012
Update (April 2012):
The last paragraph was changed to reflect the distinct
yt:display
and
display
attribute names, depending on whether the parent element is
media:credit
or
yt:username
.
By now, you may have read about the
recent launch
of connecting a Google+ profile with a new YouTube channel and questioned whether the change will affect YouTube Data API responses and, consequently, your application. The API does have a couple of changes that affect the way account names are returned, and these changes are designed to be backward compatible with applications that follow the best practices defined in our
compatibility guidelines
.
With that in mind, this post explains how to ensure that user names function properly in your application.
If your application uses authentication and refers to feeds belonging to the currently authenticated user, always use the string
default
as the username in the feed URL. For example, the URL
https://gdata.youtube.com/feeds/api/users/default?v=2
retrieves the currently authenticated user's profile no matter what type of account she has, and
https://uploads.gdata.youtube.com/resumable/feeds/api/users/default/uploads?v=2
is always the correct URL to POST to when performing a resumable upload into the current user’s account.
Avoid manually generating links to
related feeds
— instead, extract URLs for related feeds from
<link>
or
<gd:feedLink>
elements. For instance, the
profile entry for a given account
contains a
<gd:feedLink>
element with a
rel
attribute of
http://gdata.youtube.com/schemas/2007#user.playlists
, and that element's
href
attribute contains the URL for that account’s playlists.
If you do need to manually generate a feed URL that is not for the
default
user, use the value in the
<yt:username>
element as the username in the feed URL. Other fields, like
<author>
, might contain a display name or a different identifier that is not appropriate for use in a feed URL.
Note that for accounts that have connected a Google+ profile to a new YouTube channel and for
Google Accounts without a linked YouTube account
, the
<yt:username>
field will not be a traditional YouTube username. Instead, it will be a globally unique identifier that isn't intended for display in a user interface. A new field,
<yt:userId>
, will always contain this globally unique identifier regardless of the account type, and if you are writing new code to specifically deal with that identifier, we recommend reading it from
<yt:userId>
.
Any existing code that relies on displaying the
<yt:username>
or
<media:credit>
value to users should instead switch to using a value taken from one of that element's
attributes. On the
<yt:username>
element, the relevant attribute is called
display
. On the
<media:credit>
element, the corresponding attribute is called
yt:display
. The
display
or
yt:display
attribute value will always be a meaningful value suitable for display. For accounts connected to Google+, it will be set to the full public display name. For full YouTube accounts that aren’t connected to Google+, it will be set to the YouTube account name.
Cheers,
–Jeff Posnick, YouTube API Team
No comments :
Post a Comment
Labels
.net
acceleration
access control
accessibility
actionscript
activities
activity
android
announcements
apis
app engine
appengine
apps script
as2
as3
atom
authentication
authorization
authsub
best practices
blackops
bootcamp
captions
categories
channels
charts
chrome
chromeless
client library
clientlibraries
clientlogin
code
color
comments
compositing
create
curation
custom player
decommission
default
deprecation
devs
direct
discovery
docs
Documentation RSS
dotnet
education
embed
embedding
events
extension
feeds
flash
format
friendactivity
friends
fun
gears
google developers live
google group
googlegamedev
googleio
html5
https
iframe
insight
io12
io2011
ios
iphone
irc
issue tracker
java
javascript
json
json-c
jsonc
knight
legacy
Live Streaming API
LiveBroadcasts API
logo
mashups
media:keywords keywords tags metadata
metadata
mobile
mozilla
news
oauth
oauth2
office hours
open source
partial
partial response
partial update
partners
patch
php
player
playlists
policy
previews
pubsubhubbub
push
python
quota
rails
releases
rendering
reports
responses
resumable
ruby
samples
sandbox
shortform
ssl https certificate staging stage
stack overflow
stage video
staging
standard feeds
storify
storyful
subscription
sup
survey
tdd
theme
tos
tutorials
updates
uploads
v2
v3
video
voting
watch history
watchlater
webvtt
youtube
youtube api
youtube developers live
youtube direct
ytd
Archive
2015
December
November
October
May
April
March
January
2014
October
September
August
May
March
2013
December
October
September
August
July
June
May
April
March
February
2012
December
November
September
August
July
June
May
April
March
New Player Options for Lists of Videos
Minimum embeds: 200px x 200px
Keeping Things Fresh
YouTube, Google+, the API, and You
“Super Tuesday” Reporting, Powered by YouTube Direct
See you at GDC, PyCon and SXSW
February
January
2011
December
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
July
June
May
April
March
February
January
2009
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
2007
December
November
August
June
May
Feed
YouTube
on
Follow @youtubedev
No comments :
Post a Comment