YouTube videos stats using Google API YouTube Analytics in one request - google-api

Is it possible to get daily video stats for X videos at once?
YT Analytics API does stats only for a channel. Of course I can filter results by video ID (but only one!). I'm getting an error while trying to put "video=1;video=2;video=3" in filter method.

From the documentation of the reports.query endpoint of the YouTube Analytics API, assuming this is the endpoint you are referring to:
The API supports the ability to specify multiple values for the video, playlist, and channel filters. To do so, specify a separated list of the video, playlist, or channel IDs for which the API response should be filtered. For example, a filters parameter value of video==pd1FJh59zxQ,Zhawgd0REhA;country==IT restricts the result set to include data for the given videos in Italy. The parameter value can specify up to 200 IDs.
In other words: only use commas between video IDs (not semicolons), don't repeat the video keyword for each ID and use == instead of =.

Related

Youtube API, can I query videos filtering out channels?

I am writing queries to the Youtube Data v3 API and I want to see a list of videos that don't include videos by a certain channel. For example, a keyword search "iPhone" but not by Apple's channel. It doesn't work if I just do "-Apple" because that is filtering out the keyword versus the channel. Is there any way to do this?
Using as the query '"iPhone" -Apple"' removes all videos containing Apple (source), so it removes more than what you want but it does the job.
By the way Apple only uploaded 202 public videos as of today, so you could just exclude their channel id (UCE_M8A5yxnLfW0KghEeajjw) from the results you got with Search: list.

YouTube API V3 publishedAfter / publishedBefore not working

I need help on calling Services > YouTube Data API v3 > youtube.search.list. I tried several times a few days ago and it worked just fine. Today, it does not return correct year. It included 2016.
part - snippet
channelid - UC-lHJZR3Gqxm24_Vd_AJ5Yw
publishedAfter - 2018-12-17T16:05:58.000Z
publishedBefore - 2018-12-20T16:05:58.000Z
Because Search: list can only retrieve channels, videos and playlists according to type parameter, I assume that by specifying a channelId you are looking for videos and playlists during a given period of time of a given YouTube channel.
Playlists are easily retrievable with https://www.googleapis.com/youtube/v3/playlists?part=snippet&channelId=UC-lHJZR3Gqxm24_Vd_AJ5Yw&key=YOUR_API_KEY.
And about videos because Search: list isn't reliable I would recommend you to get all videos for the given YouTube channel and then proceed to your sort on your own. I would recommend you to use this approach to retrieve all YouTube videos of a given YouTube channel. The approach consists in getting the uploads auto-created playlist id of the YouTube channel by using Channels: list with contentDetails in part and then use PlaylistItems: list to retrieve all public videos uploaded on this YouTube channel.

YouTube API liveBroadcastContent field incorrect for stream

When I hit the video list endpoint on the YouTube API (https://www.googleapis.com/youtube/v3/videos), and pass a stream's id for in the "id" field, I always get back the following result for the liveBroadcastContent field:
"liveBroadcastContent": "none"
I am relying on this field to determine whether or not a video is a stream. But if this field does not return "live" for a stream which is live, I can't determine if the video is a stream. It is worth noting that the request is sent within a few minutes of the stream starting, so that may have something to do with it.
Is there a more reliable way to find out whether a YouTube video is a stream?

Youtube video search result sorting order does not match with youtube.com

Youtube data API v3:
Youtube data api v3 does not return video list in the same order as youtube.com when searching with a specific query like "old hindi songs"
Why??
There can be many reasons for this. But this doesn't mean that you're doing something wrong. It's supposed to be this way.
For example if you are logged in in youtube, youtube will order the results taking in account videos you watched or liked, while the data api does not have access to this info. Also it may filter the results based on your region, while the api will filter by region only if specifically told so.
Try running your browser in incognito, don't log in into youtube, and perform from there a youtube search. The results should 90% match those received from api v3 if of course your request to the api has the order parameter set to relevance.

What is counting on rate limit of soundcloud?

In my application I have a search list of musics and an embedded player. I need refactor some functions, but I can't understand what is the specific count event. What is counting in rate limit by SoundCloud? Search for list song is measured? Play calls?
In SoundCloud doc text we have:
"Effective July 1, all requests that result in access to a playable stream are subject to a limit of 15,000 requests per any 24-hour time window".
This refer the all JSON's calls only?
A play request is defined as any request against the SoundCloud API which would generate a URL for streaming audio content in its response.
For example, a GET to http://api.soundcloud.com/tracks/3/stream returns a URL which you can use to stream audio content. This request would count against your daily rate limit of play requests.
Hope that helps.

Resources