How to fetch YouTube shorts view count and public videos view count using Youtube data/reporting APIs? - youtube

I wanted to fetch the youtube shorts views count and youtube public view count to check the monetization status of my youtube account.
Normal views metrics in youtube API return views on all videos including unlisted ones. Could not find any filters for public views.
Could not find anything for youtube shorts in the docs.
Screenshot of the similar data in youtube studio.
Is it possible to fetch these data?
Tried fetching the views on each video and identify shorts and public videos from it. But I couldn't find anything to differentiate between shorts and a normal video. Same for public /unlisted videos.

But I couldn't find anything to differentiate between shorts and a normal video. Same for public /unlisted videos.
To distinguish shorts and normal videos, use this Stack Overflow answer relying on a web-scraping approach of the YouTube UI.
Concerning distinguishing public and unlisted videos, use YouTube Data API v3 Videos: list endpoint with part=statistics to retrieve the viewCount field.

Related

YouTube API : Getting list of channels of a specific genre

I want to get list of channels of a specific genre in my App using YouTube API.
For Example -
I want to get list of all comedy channels on YouTube in my App.
Is this possible , if yes than How ?
YouTube's V3 API doesn't have a category for each channel.
Take a look at this similar question: How to get the Channel Type or Category of each YouTube channel using YouTube API?
YouTube documentation for this: https://developers.google.com/youtube/v3/docs/channels
The YouTube API does however show if videos and by extension channels make videos for kids.

YouTube API retrieve URL of unlisted or private livestream?

I want to use the YouTube API to check for a current livestream and get it's URL. The livestream is UNLISTED.
I can successfully get information on my PUBLIC livestream from my channel using this:
https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=MyChannelId&type=video&eventType=live&key=MyApiKey
However it does not return any results when the livestream is UNLISTED.
What am I missing here?
EDIT:
I am using PHP if that matters.
It appears that this is probably what I am trying to implement: https://developers.google.com/api-client-library/php/auth/service-accounts
And perhaps I will need to use liveStream or liveBroadcast? https://developers.google.com/youtube/v3/live/getting-started
This is the intended feature for any UNLISTED videos/streams. They cannot be accessed like regular vids. UNLISTED vids can only be accessed through:
anyone who knows the video's unique video ID can retrieve the video
metadata.
as mentioned in Youtube properties.
Also Jeff Posnick of Youtube answered in this google forum:
The public videos feed doesn't contain any information about private
or unlisted videos, so they won't be returned in the results.

How to Retrieve the Video ID from private videos within a public Playlist- YouTube API v3?

I need some help getting the video ID number and the video title ( the title would be "Private video") for all private videos within a public playlist. Specifically I'd need help editing my script below. This script used to be able to do that, but I fear something has changed with Youtube's API. I want to know if there is any way to get this information and fix my script.
My script is located here
Just a month ago my script (see above) was able to retrieve video ID numbers and video names of private videos when fetching playlistItems from a playlistid (of course the video titles were renamed "Private video" - but that is the info I wanted). Unfortunately now when I fetch the same playlistid from youtube it hides all this info. It acts as if there are no videos in the playlist when a playlist contains private videos. Here is a question asked last year, it shows you can pull the video ID numbers and names from a playlist that contained private videos. Retrieve Video IDs contained in a Playlist - YouTube API v3
Here is an example of a playlist I would want to fetch the video ID and video name from.
https://www.youtube.com/playlist?list=PLAg_-NsALZoOLfXbX7eGIzFsbG21XAvct
I haven't tried it but you can try PlaylistItems: list and Advanced Google Services
Returns a collection of playlist items that match the API request parameters. You can retrieve all of the playlist items in a specified playlist or retrieve one or more playlist items by their unique IDs.
AFAIK if you own the private/unlisted videos, you can get the videos using Youtube API v3. You can read these related SO questions - Using the YouTube API v3 to list all private videos, Google Youtube Data API: Private videos with API key and Google YouTube API (v3): how to access my unlisted/private videos from my server? that all discuss retrieving the ID as the owner of the videos.
This issue has been fixed. You now get the behavior you were used to.

How to display the Private Videos of my YouTube channel

How do you display private videos from my YouTube channel to my own Website.
Thank you
Instead of setting the video to private, set it to unlisted. It won't appear in any listing on youtube, i.e. your channel, search results & related videos but you can link to it and embed it like a normal video.

Filter videos for children youtube API

I am developing an iOS video player app for children. Is there a way to filter youtube videos for children by using youtube api.
May be i'm wrong, but I think there there is no specific filter youtube videos,
but you can set safeSearch=strict or
search in education category

Resources