Having a youtube partner account, I need to programmaticly set the 'usage policy' of the monetization section.
When I update this field from the youtube interface for my video, I can see that the contentDetails/regionRestriction have been correctly updated.
But when I programmaticly call the update YouTube Data API v3, setting the contentDetails/regionRestriction seems to have no effect.
Which API should I call in order to programmaticly update this field (contentDetails/regionRestriction)?
Actually the process is a little bit more complicated than that.
You cannot directly set these values using the upload API.
After the upload, you have to use a contentManager account to create a policy (or use a default one) , create an asset and set the ownership of the asset. This is where you can set the restrictionRegion section. After that, you have to claim the uploaded content with your video id, policy id and asset id.
Related
Am trying to figure out the API. Were in the web interface can, as an administrator, find the "content owner id" of my managed accounts?
All I see is this:
"To retrieve a content owner report, call the API's reports.query method and set the ids parameter value in the API request to contentOwner==OWNER_NAME, where OWNER_NAME specifies the content owner's ID. Ask your partner manager if you are unsure of the value."
Surely I don't have to call Google to get this value?
If you want to know the content owner id of only one account, you can check the URI.
There are various ways to retrieve the id from the URI:
Log in on https://studio.youtube.com/ and switch the account to the
one you're trying to get the id of (on the top right click on the
account logo, then on "Switch account"). When you've switched to the
new account, the content owner id should be in the URL in the part
that follows https://studio.youtube.com/owner/.
Go to https://www.youtube.com/analytics and switch to the desired
account. The content owner id is what follows
https://www.youtube.com/analytics?o= and before &ar.
The second option should also work for other sections in the Youtube
creator studio.
If you want to retrieve a list of all content owner IDs linked to your admin account, it's much easier to do it via the API. If you don't want to write a script for that, you can just use the Google API explorer (on the right) here: https://developers.google.com/youtube/partner/docs/v1/contentOwners/list
Just set fetchMine to true and sign in to your account. The output below should give you a list of the content owner names, IDs and other info.
To retrieve the content owner IDs via the API, samples can also be found here:
https://developers.google.com/youtube/partner/code_samples/
(check the docs "Retrieve a content owner's managed channels (channels.list)" in your language).
You may refer with this SO answer on how to get the content owner id.
Assuming you have an OAuth 2 token with access to the https://www.googleapis.com/auth/youtubepartner scope, you can make an API call to youtubePartner.contentOwners.list(fetchMine=true) to get back a list of YouTube content owners associated with the current OAuth 2 token. (There will normally only be one item returned.) You can then get the content owner id value from the id property of each item in the items list that's returned. This is the value that you can use when making content owner YouTube Analytics API reports, or using the onBehalfOfContentOwner delegation parameter in the YouTube Data API v3.
You need to query youtubePartner.contentOwners.list(fetchMine=true) to obtain the content owner info. Also make sure that you have this API available in your console or ask your partner manager if you are eligible for this API.
I'd like to get the impressionBasedCpm from the Api Explorer ( and later from my app).
I can log in with an youtube partner account and toggle the oauth switch. I set all scopes to checked.
Then I try to enter
ids: contentOwner==NAME_OF_CONTENT_OWNER (not the id, retrieved from the content API, https://developers.google.com/youtube/partner/docs/v1/contentOwners/list#try-it)
metrics: impressionBasedCpm
start-date: '2015-05-01'
end-date: '2015-06-01'
The output still tells me:
You do not have permission to execute this method.
Can someone help me?
My guess is that when I authorize the application I seam to still login as a channel, so the query as a content owner is not allowed. I picked the main one with the email address. But when I'm on youtube I can switch to a specific Content-Manager Channel/Account.
Even when I try to just get the 'likes' for the contentOwner it doesn't work. If I try to get the likes based on the channel_id it works. But I like to get reports for a youtube partner that uses youtube's cms.
cheers
This query won't work because it does not follow the semantics of the API. You need to provide the ID of the contentOwner in order to get a 200 OK response. Name of Content Owner cannot be unique and hence would lead to erroneous results.
I am in process of migrating from DMCloud to DM Partner Program and was wondering if there was an equivalent for,
get_embed_url()
get_stream_url()
Link to dmcloud documentation
Goal:
To be able to receive embed urls from DM for private videos. It seems DM's player API returns iframe and link is not signed / perishable.
Thanks.
With Dailymotion API, you can query the following fields on the video object:
embed_url which is the url to embed the video. If your video is private, this query returns an url to embed the video with an id beginning by "k", it is the private id of the video. If you share it (embed the video on a public web page), the video is no longer "private" (any user checking the code will be able to access the embed url).
stream_source_url and all others stream_*_url fields. It refers to the URL of this video source. This field has some protections:
only the owner of the video can retrieve it, (s)he has to pass a valid access token otherwise this field returns null
the url can only be consumed by the user who made the api call
the url returned is valid for 2 days
this field is rate limited
I've been trying to figure this out for quite some time now. I am trying to Display most recently uploaded video from a specific user. First I tried doing It with most_recent (https://gdata.youtube.com/feeds/api/standardfeeds/GB/most_recent) etc.., but I soon realized that It is only able to get most recent video from a specific country, not user specific like I want. So the question is, what IS The url to get to user specific latest upload? All the google's pages about their API didn't mention a word about it(or I'm blind)
Pages I've read:
https://developers.google.com/youtube/2.0/reference?csw=1
https://developers.google.com/youtube/2.0/developers_guide_protocol#Standard_feeds
Getting most recent youtube video links for a user using API
https://developers.google.com/youtube/2.0/developers_guide_protocol_video_feeds
I suggest to use Data API v3 instead of GData since it's the supported API. Support and new features will only come to Data API v3.
The way to do in v3 is, you first do a channels->list with part=contentDetails and mine=true to get authorized user's channel or id=USERS_CHANNEL_ID or forUsername = USERS_USERNAME
like GET https://www.googleapis.com/youtube/v3/channels?part=contentDetails&mine=true&key={YOUR_API_KEY}
in the response you get uploads playlist id and put it into playlistItems->list call in "id" parameter
GET https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&id={ID}&key={YOUR_API_KEY}
Uploads playlist is in order, so first result is the most recent upload. If you just want that result, in the call you can set maxResults=1
If you want to use api version 2 instead of 3: Here is the documentation link:
https://developers.google.com/youtube/2.0/developers_guide_protocol_video_feeds#User_Uploaded_Videos
The url to use is:
https://gdata.youtube.com/feeds/api/users/userId/uploads
;Where you replace userId, with the id of the specific user.
Use: https://gdata.youtube.com/feeds/api/users/userId/uploads?max-results=1 , if only 1 result is needed.
I am trying to get all the playlist feed URLs from the YouTube channel in my iOS application.
Below is the URL to get the XML data consists of the required contents.
https://gdata.youtube.com/feeds/api/users/thenewboston/playlists?v=2
This is working fine, which results in the response of an XML with data.
But when I change this to my username nothing is retrieved. I have couple of playlists in my channel.
My Attempts:
Attempt 1:
I have googled and cross checked my channel's privacy settings which is Public in default.
Am I making any wrong? Please let me know your comments.
Attempt 2:
When I try like this in browser, http://www.youtube.com/user/myusername
getting "This channel is not available at the moment. Please try again later.".
The same url is working fine for thenewboston.
Try this
https://gdata.youtube.com/feeds/api/videos?v=2&author=USER_NAME&orderby=published
This will fetch all the user videos.
I have found the solution:
Below is the format that I have tried.
https://gdata.youtube.com/feeds/api/users/userId/playlists?v=2
But it seems there is some change in the API.
To request a feed of another user's playlists, send a GET request to the following URL. This request does not require authentication.In the URL above, you should replace the text userId with the user's YouTube user ID. For backward compatibility purposes, the API also supports having the user's YouTube username specified instead.
To find the userId in YouTube : (Follow the steps below)
Click the arrow on top right after login to your YouTube account.
Select YouTube settings.
Select the link Advanced and find the YouTube User Id there.
Reference : YouTube API v.2.0