I've tried to build an app that makes a youtube-api activities list request every x seconds, to look for new things that happened on some channels. The code works fine but some channels give me no response back about the activities. The request will work fine and give no error but there are no data.
Hope you know what I mean and somebody has a solution for me.
Tried it also here : https://developers.google.com/youtube/v3/docs/activities/list
but same problem - request is successful but no items inside.
I also was unable to get new uploads information for that channel ID using the Activities:List
API request. However, I was able to use a different API request (actually a series of two) and successfully get the 50 most recent uploads.
If you only need uploads, as your comment suggests, this could be a solution. It uses Channels:List and PlaylistItems:List API requests, at a quota cost of one unit each:
First, the Channels:List call retrieves the uploads playlist ID: get playlist ID:
https://www.googleapis.com/youtube/v3/channels?part=contentDetails&id=UCJgcqQq2WyJf35ovKj8fFeQ&maxResults=10&fields=items&order=date&key=YOUR_API_KEY
The response from Youtube contains JSON code:
{
"items": [
{
"kind": "youtube#channel",
"etag": "\"XpPGQXPnxQJhLgs6enD_n8JR4Qk/JLM6UA_xPnpiDQtL6ILexatJ0sc\"",
"id": "UCJgcqQq2WyJf35ovKj8fFeQ",
"contentDetails": {
"relatedPlaylists": {
"uploads": "UUJgcqQq2WyJf35ovKj8fFeQ",
"watchHistory": "HL",
"watchLater": "WL"
}
}
}
]
Using the uploads playlist ID from the above response, make the PlaylistItems:List call. Max-results
sets up to 50 latest items:
https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&fields=nextPageToken,items(snippet(publishedAt,title,description,thumbnails(default(url)),resourceId(videoId)))&playlistId=UUJgcqQq2WyJf35ovKj8fFeQ&maxResults=50&order=date&key=YOUR_API_KEY
The response contains 50 most recent videos, date-sorted. Including publish date, title, description, thumbnail image url, video ID , and nextpage token (used if you want to get 50 more items):
{
"nextPageToken": "CDIQAA",
"items": [
{
"snippet": {
"publishedAt": "2019-06-07T18:30:01.000Z",
"title": "BATMAN a Telltale Story | Folge 22 [Deutsch LP]",
"description": "! Willkommen Freund von #GamingausLeidenschaft !\n\nFolge 22 zeigt wer der wahre maskierte Rächer Gothams ist.\n\n!!Viel Spass!!\n****************************** \nDir gefällt was ich mache? \nDann lass es am besten alle wissen und schlag doch \netwas den Subscribe/Abobutton der braucht Nähe ;)\nDu warst nicht Zufrieden?\nDann lass dir freien Lauf das in den Kommentaren zu erwähnen :)\nJede Form von Feedback sehe ich als Support!\n******************************\nTweet me: twitter@brille591 \n******************************\nDiscord Server : https://discord.gg/eRwmFM\n******************************\nFalls du möchtest kannst du mir unter diesem Link:\n\nhttps://streamlabs.com/Skarkerino\n\nein kleines Trinkgeld zukommen lassen \n(alles wird in Equipment und Qualitätsverbesserung gesteckt) \nAktuelles Ziel: RAM\n******************************\nÜBER DIESES SPIEL\nBatman: The Telltale Series ist ein am 2. August 2016 veröffentlichtes Computerspiel des Entwicklers Telltale Games. \nDatum der Erstveröffentlichung: 2. August 2016\n-\nSpiel-Engine: Telltale Tool\nSprache: Englisch (Audio), Deutsch (Untertitel)\nHerausgeber: Telltale Games\nPlattformen: PlayStation 4, Android, Nintendo Switch, Xbox One, PlayStation 3, Xbox 360, Microsoft Windows, iOS\nDesigner: Mark Darin, Michael Kirkbride\n\n#BATMAN\n#Telltale\n#Brille591\n#Optiksquad\n#Deutsch\n#LP\n#DC\n#WB",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/ZZSDYaW0nxw/default.jpg"
}
},
"resourceId": {
"videoId": "ZZSDYaW0nxw"
}
}
}, ... etc.