I am trying to use Youtube analytics but I am not sure how to fill out the parameters properly
Here is the form I am trying to fill out: https://developers.google.com/apis-explorer/#s/youtubeAnalytics/v1/youtubeAnalytics.reports.query
How do you find out the value of ids?
It states: Unique channel or content owner ID for retrieving YouTube Analytic data. Either channel==C or contentOwner==O where 'C' is the encrypted channel ID and 'O' is the content owner name. (string)
I have tried contentOwner=={myapikey}
where {myapikey} is an api key for my google app
How do I get the proper value of ids?
My goal is to execute a query on the above link.
You can get the values for the currently logged in user that you can put into ids=channel==%here$% using an authenticated call to https://developers.google.com/youtube/v3/docs/channels/list
For ids=contentOwner==%here%:
This is for the case where your user is associated to a YT content owner. Right now you would need to ask your client (a YT content owner) to get this ID. The client can get it from their partner manager.
Related
I'm trying to find a way to retrieve all videos posted by a given user (eg: https://www.youtube.com/user/laliga/videos).
All the examples I've found online or the doc (https://developers.google.com/youtube/v3/docs/) seems to require either a playlist ID, channel ID or video ID.
Is there any way I can directly query the author's videos or am I forced to retrieve all playlists and then iterate over?
Thanks
You just need to map the user name to its channelID first via the YouTube API like so:
https://www.googleapis.com/youtube/v3/channels?forUsername=USER_NAME&part=id&key=API_KEY
Full docs: https://developers.google.com/youtube/v3/docs/channels/list
Then you can make a Videos:List call with that channelID to get the videos.
1)take your google key id and channel id and put inside below url
https://www.googleapis.com/youtube/v3/search?key=APIKEY&channelId=CHANNELID&part=snippet,id&order=date&maxResults=20
ex
https://www.googleapis.com/youtube/v3/search?key=adsjsdakhkjshd&channelId=sdahghsadhgj&part=snippet,id&order=date&maxResults=20
Youtube allows a username and channel name. They can be different from each other. The youtube API allows me to search via username but I can't see where or how to search by channel name. It is the channel name that is displayed under the videos.
Anyone shed some light onto how I can search via channel name/title and not username?
Thanks
If the channel search API didn't return a result I call the search API
https://www.googleapis.com/youtube/v3/search?part=snippet&type=channel&maxResults=1&q=(<# potential channel name #>)
So it runs a standard search for entered value "potential channel name". Google docs say the first returned result will be a channel so we only need 1 result which is why we set maxResults=1.
If that returns nothing then I assume channel does not exists and display error to user
This works with me, just change the key with your api-key
url1="[https://www.googleapis.com/youtube/v3/search?part=snippet&type=channel&maxResults=15&q=Inna&key=[YOUR-API-KEY]"
r = requests.get((url1))
print(r.content)
It returns all channels with names that contain the word Inna
Hope this can help you
I've to call this Twitter API's method
https://api.twitter.com/1.1/lists/statuses.json?list_id=12345
to retrieve the tweets by the user in the list.
But my customer provide me only the name of the list and I've no idea how to get the list id using the list name.
The list is this: https://twitter.com/DatasportNews/lists/i-campioni-di-brasile2014.
I've tried with this method
https://api.twitter.com/1.1/lists.json?screen_name=i-campioni-di-brasile2014
to get the id list but always return this message
{"errors":[{"message":"Your credentials do not allow access to this resource","code":220}]}.
I'm logged with api key and api secret and get the token well, but this method doesn't work.
Ideas ?
The list name in the URL is referred to as the slug. When you want to request statuses from a list using a slug, you simply also need to pass the owner_screen_name.
For example, in your case:
/1.1/lists/statuses.json?slug=i-campioni-di-brasile2014&owner_screen_name=DatasportNews
More details on this are on the endpoint's doc page at https://dev.twitter.com/docs/api/1.1/get/lists/statuses
I am retrieving all of the videos for a given channel by:
'https://gdata.youtube.com/feeds/api/users/{username}/uploads'
When I go to a channel, such as: http://www.youtube.com/channel/UCXIyz409s7bNWVcM-vjfdVA I have the channel ID and I can quite clearly see the videos. Also, if I click on the 'Videos' tab I can see all the videos, but the URL changes to: http://www.youtube.com/user/majesticcasual/videos
I would like to take the channel ID and retrieve the username for the given channel such that I can query YouTube's API for the videos by channel ID. Is this possible?
If you retrieve this feed:
https://gdata.youtube.com/feeds/api/users/[channel_id]/
You'll get a response that includes an <author> element -- the <name> child of that <author> element is the username. It's also repeated in that same feed as <yt:username>.
Of course, that's kind of moot, because you can query by channelID directly:
https://gdata.youtube.com/feeds/api/users/[channel_id]/uploads
is the same feed as if you'd used the username. This works because the channel_id really is just the unique ID of someone's username.
If you want to use v3 of the API (Which is highly encouraged, as it's at production level now), you could use this feed:
GET https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=UUXIyz409s7bNWVcM-vjfdVA&key={YOUR_API_KEY}
Note that I've changed the channel id so instead of starting with UC (as all channel ids do), I'm passing in a value that starts with UU ... this is so you get back the uploads feed of the channel (you could also have it start with LL instead to get back the 'likes' feed, for example ... or even do a request to:
GET https://www.googleapis.com/youtube/v3/channels?part=snippet%2CcontentDetails&id=UCXIyz409s7bNWVcM-vjfdVA&key={YOUR_API_KEY}
To retrieve, in the contentDetails parameter, all of the playlists associated with that particular channel.
I am authenticating with google to try and get youtube analytics my problem is that i don't know how to filled you the parameters when quering youtube
here i am making a new service: and then try to query it
I am not sure what to put in the "ids" parameter or where to find it?
What do I put there?
_analyticService = new YoutubeAnalyticsService(_authenticator = CreateAuthenticator());
...
_analyticService.Reports.Query("ids", "2013-01-01", "2013-02-02", "views").Fetch();
The ids parameter is the an expression with the id of your channel. If you go to http://www.youtube.com/analytics and click on the title with your own channel name, you get a link like http://www.youtube.com/channel/UCYHMS8hN8s49F93iJuEgG6w The last part is the id of your channel. You have to use this as the ids parameter in an expression like "channel==UCYHMS8hN8s49F93iJuEgG6w". This is to query in the context of your own channel. This is needed as you might have access to several channels.
I can query views for one of my videos by: https://www.googleapis.com/youtube/analytics/v1/reports?ids=channel%3D%3DUCYHMS8hN8s49F93iJuEgG6w&start-date=2013-01-01&end-date=2013-02-02&metrics=views&dimensions=day&filters=video%3D%3D_iwmv6644dA&sort=day&key={YOUR_API_KEY}
Try to use the API explorer at the bottom of this page, there are some text explaining the different parameters there as well. https://developers.google.com/youtube/analytics/v1/
Hope it goes well!