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
Labels
.net
360
acceleration
access control
accessibility
actionscript
activities
activity
android
announcements
apis
app engine
appengine
apps script
as2
as3
atom
authentication
authorization
authsub
best practices
blackops
blur faces
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
machine learning
mashups
media:keywords keywords tags metadata
metadata
mobile
mozilla
NAB 2016
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
Super Chat API
survey
tdd
theme
tos
tutorials
updates
uploads
v2
v3
video
video files
video transcoding
virtual reality
voting
VR
watch history
watchlater
webvtt
youtube
youtube api
YouTube Data API
youtube developers live
youtube direct
YouTube Engineering & Developers Blog
YouTube IFrame Player API
YouTube live
YouTube Reporting API
ytd
Archive
2020
Nov
2019
Aug
Apr
2018
Dec
Aug
Apr
2017
Nov
Sep
Aug
Mar
Jan
2016
Nov
Oct
Aug
May
Apr
2015
Dec
Nov
Oct
May
Apr
Mar
Jan
2014
Oct
Sep
Aug
May
Mar
2013
Dec
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
2012
Dec
Nov
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
Jan
2011
Dec
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
Jan
2010
Dec
Nov
Oct
Sep
Jul
Jun
May
Apr
Mar
Feb
Jan
2009
Nov
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
Jan
2008
Dec
Nov
Oct
Sep
Aug
Jul
Jun
May
Apr
Mar
Feb
2007
Dec
Nov
Aug
Jun
May
Feed
Follow @youtubedev