Valezart
Valezart

Reputation: 13

Obtaining data from YouTube API using the last video filter (order=date) stopped working

I have a list of channels from which to show the last uploaded video of each one. Obtaining data from YouTube API using the last video filter (order=date) stopped working, the results are now random, using the same code.

I've been looking at forums but I can't find the solution to this problem. The code is fine, I deduce that the API has changed in some way.

$json = file_get_contents("https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=".$channelID."&maxResults=1&order=date&type=video"."&key=mykeyhiddenforsecurity");

Expected: using (order=date) So far it has resulted in the data of the last video uploaded from that specific channel.

Actual: Now, with the same code and filter, the result is a totally random video of the channel.

Upvotes: 0

Views: 451

Answers (1)

stvar
stvar

Reputation: 6965

The issue described is known for more than a week now. It affects all users of Search endpoint.

Good news is that there are workarounds for to make old code working again until Google reinstates the API features it disabled: one may use the PlaylistItems endpoint queried for the given channel's uploads playlist.

You may follow my answer https://stackoverflow.com/a/55246970/8327971 or Google's own thread on this issue https://issuetracker.google.com/issues/128673552 (which started ten days ago).

Upvotes: 2

Related Questions