0

I am using youtuve v3 https://www.googleapis.com/youtube/v3/search api to get the list of videos in a channel.

Also, trying to use etag to use caching to avoid quota limit in youtube api. I am always get different etag for each request.

So i would like to know is this search api support etag caching?. I am using php curl to get the results.

eg:

        $curl = curl_init();
        curl_setopt($curl, CURLOPT_URL, $url);
        curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($curl, CURLOPT_HEADER, true);
        curl_setopt($curl, CURLOPT_FILETIME, true);
        curl_setopt($curl, CURLOPT_HEADER, 'If-None-Match: "'.$eTag.'"' );

        $curl_exec = curl_exec($curl); 
Shijo Rose
  • 193
  • 5
  • 17
  • How will using the Etag help you avoid quota? – Linda Lawton - DaImTo Jun 15 '20 at 12:15
  • As per youtube doc ETag change only when there is a change in the response data. otherwise it respond with a 304 status. This will help to use the cached response. https://stackoverflow.com/questions/21752421/youtube-api-v3-and-etag – Shijo Rose Jun 15 '20 at 12:35

0 Answers0