I'm using the YouTube v3 API to fetch the user's videos uploaded on the channel.
I need the video statistics (mainly the view count) for specific time-frames in a video. For example: from 10 second to 15 second in the video. Or maybe at the 10th second.
How can this be achieved? I have gone through the API docs but don't see any parameter or section that can provide that data.
Code snippet to fetch the data of completed livestreams / liveBroadcasts:
request = youtube.liveBroadcasts().list( part="snippet, status", broadcastStatus="completed", broadcastType="all")response = request.execute()
Then for each video from the list data returned, I'm running the following API to fetch the video related data:
request = youtube.videos().list( part="snippet, contentDetails, statistics, liveStreamingDetails, status", id=videoID)response = request.execute()return response
Sample Response
{"kind": "youtube#videoListResponse","etag": "JI93kvK9Gsz3h2R_OvkmgPkUrqs","items": [ {"kind": "youtube#video","etag": "NfG5gw0fBnjykGf8db9FiaBXw3M","id": "FNS_JCM-H3U","snippet": {"publishedAt": "2022-02-27T19:20:15Z","channelId": "UCVxNxW5_GhdS_o8m4PyHsmg","title": "Time Check Test","description": "","thumbnails": {"default": {"url": "https://i.ytimg.com/vi/FNS_JCM-H3U/default_live.jpg","width": 120,"height": 90 },"medium": {"url": "https://i.ytimg.com/vi/FNS_JCM-H3U/mqdefault_live.jpg","width": 320,"height": 180 },"high": {"url": "https://i.ytimg.com/vi/FNS_JCM-H3U/hqdefault_live.jpg","width": 480,"height": 360 },"standard": {"url": "https://i.ytimg.com/vi/FNS_JCM-H3U/sddefault_live.jpg","width": 640,"height": 480 },"maxres": {"url": "https://i.ytimg.com/vi/FNS_JCM-H3U/maxresdefault_live.jpg","width": 1280,"height": 720 } },"channelTitle": "Streampala","categoryId": "20","liveBroadcastContent": "none","localized": {"title": "Time Check Test","description": "" },"defaultAudioLanguage": "en-US" },"contentDetails": {"duration": "PT1M20S","dimension": "2d","definition": "sd","caption": "false","licensedContent": False,"contentRating": {},"projection": "rectangular","hasCustomThumbnail": False },"status": {"uploadStatus": "uploaded","privacyStatus": "public","license": "youtube","embeddable": False,"publicStatsViewable": True,"madeForKids": False,"selfDeclaredMadeForKids": False },"statistics": {"viewCount": "4","likeCount": "0","dislikeCount": "0","favoriteCount": "0","commentCount": "0" },"liveStreamingDetails": {"actualStartTime": "2022-02-27T19:20:33Z","actualEndTime": "2022-02-27T19:21:53Z","scheduledStartTime": "2022-02-27T19:20:12Z" } } ],"pageInfo": {"totalResults": 1,"resultsPerPage": 1 }}