Hi
I have below code . I want to get description , search keywords of that video which have been published since last 2 days. I want only shorts Video.
var client = new RestClient("youtube/v3");
var request = new RestRequest("search", Method.GET);
request.AddParameter("part", "snippet");
request.AddParameter("q", "sports shorts");
request.AddParameter("maxResults", "100");
request.AddParameter("type", "video");
request.AddParameter("order", "viewCount");
request.AddParameter("videoDuration", "short");
Thanks
Naimish MakwanaPosted Apr 3, 2024, 5:06 AM
To get videos that have been published in the last 2 days, you can use the
publishedAfterparameter of the YouTube Data API. This parameter specifies the earliest date and time that a video could have been published to be included in the API response. The value is specified in RFC 3339 format.You can calculate the date for 2 days ago in C# and convert it to the RFC 3339 format. Here’s how you can modify your code:
This will return videos that match your query and have been published in the last 2 days.
Please note that you need to replace
"youtube/v3"with the actual base URL of the YouTube Data API v3, which is"https://www.googleapis.com/youtube/v3".Also, remember to include your API key in the request:
Replace
"YOUR_API_KEY"with your actual API key. If you don’t have an API key, you can create one in the Google Cloud Console.Thanks
Uday DodiyaPosted Apr 3, 2024, 4:37 AM
Hi Ramco,
try following
Jithu ThomasPosted Apr 3, 2024, 4:23 AM