Get recommendation videos from youtube api - youtube-api

I need to get some recommended videos for loggined user from youtube api. I am using this request
GET GET https://www.googleapis.com/youtube/v3/activities?part=snippet&home=true&maxResults=50&key={YOUR_API_KEY}
But in response i receive only 4 videos and all the same in every request. So how do i get all recommended videos i want?

You should be able to get the videos from your subscribed channels with that request. You can also try chart=mostpopular for most popular videos.
More info:
http://apiblog.youtube.com/2013/09/what-to-watch-our-apis-can-help.html

Related

Get Only Video and not cortos videos

Good morning
I am using the youtube api to get the latest videos from a channel, but I also get the short videos that are like instagram or tiktok reels, is there any way to not get these videos?
I leave the endoint I am using
https://www.googleapis.com/youtube/v3/search?channelId=${channel_id}&part=snippet,id&order=date&maxResults=${totalVideos}&key=${API_KEY_YOUTUBE}
Greetings and thank you
If you check the Search.list method you will notice that it does not have any way of limiting the data that is returned.
You will need to remove these locally.
It may be worth adding a feature request to the issue forumn

How to know if a video has been seen/hidden?

Using the YouTube Data API v3, is there a way to know if a video has been seen or hidden?
Reading through the docs, I didn't see anything on the Video resource that could match what I'm looking for.
Logically, “Watched” videos are just videos which have entries on your “Watch History” on Youtube.
You can get your “Watched” videos list through the API by getting your Watch History list from your channel. You can do that by using obtaining your Watch History ID which at the same time is also treated as playlistId.
Referring through the Channel API, make a GET HTTP request to
https://www.googleapis.com/youtube/v3/channels?part=contentDetails&mine=true&key={YOUR_API_KEY}
This should return a JSON which should contain an object with “watchHistory” key. The value paired with it is your playlistId which you can now use to make a request using the PlaylistItems API
https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId={YOUR_WATCHED_PLAYLIST_ID}&key={YOUR_API_KEY}
This should return a list of videos that your account has already watched.
As for getting the list of “Hidden” videos on your subscription feed. I think it's not achievable through the API. Checked on different responses of subscription and video resources but to no avail. No responses containing "watched" or "hidden" related.

How to get list of live video broadcasts using youtube api v3

I'm having an hard time trying to figure out how I can get a list of videos that are live for a given channel. For instance for this channel:
https://www.youtube.com/channel/UC4R8DWoMoI7CAwX8_LjQHig
I can get the videos from the uploads playlist or any playlist without any issue. However, I can't figure out how to get a list of live broadcasts.
Many thanks in advance
Solved by using:
https://developers.google.com/youtube/v3/docs/search/list
There, you can filter by channelId and filter by live only if you add type=video and eventtype=live.
Thanks anyway

Get videos from youtube api from channel

How can i get videos from the youtube channel with duration and views count?
I tried this request:
https://www.googleapis.com/youtube/v3/search?part=snippet%2Cid&channelId=UC4H3KiOO86uiw2fAoZy6NRA&key=YOUR_API_KEY
but response doesn't contains duration/views count. Any ideas? Thx.
That data is not available in the snippet field. Instead, make a second API call to the channels.list() with the video IDs and request the contentDetails and statistics fields in your response. You can find documentation on the video resource here.

How to get youTube broadcasted-video URL using youTube API?

Is it possible to get youTube broadcasted-video URL using youTube API?
As I realized, broadcasted video URL changes everytime broadcasting is restarted.
I want to get new URL programmatically, and show broadcast-video in iFrame in my website.
Are all these possible?
Actually the answer is very easy:
From Youtube Data API documentation I've found the method where I can fetch all videos by author:
https://gdata.youtube.com/feeds/api/videos?author=crystalspringllc
And there is a video URL I want.

Resources