I want to get the “trending” clips from a channel, and it looks like New Twitch Api can only order them by view count.
So I had to use kraken and it looks like this :
<?php
public function getTopClips($channel_name, $period = 'week', $max = 5, $trending = true)
{
$url = 'https://api.twitch.tv/kraken/clips/top?channel='.$channel_name.'&limit='.$max.'&period='.$period.'&trending='.$trending;
$opts = [
"http" => [
"method" => "GET",
"header" => "Client-ID: ".$this->client_id .
"Accept: application/vnd.twitchtv.v5+json"
]
];
$context = stream_context_create($opts);
$json_result = file_get_contents($url, false, $context);
$result = json_decode($json_result);
return $result;
}
And I’m getting this error : Warning: file_get_contents(https://api.twitch.tv/kraken/clips/top?channel=solary&limit=5&period=week&trending=1): failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found
Everything works fine when I use Helix, so I guess there is something I don’t understand about kraken.
Also, is it possible to get clips from multiple channels with one request ?