'With the YouTube API, how can I get the Unique viewer for a YouTube video?
It's confusing some doc says it's deprecated but other pages explains how to see it in the web interface. If it's visible from studio.youtube.com it should be accessible from the API... right?
Q: With the API, how can I get the Unique viewer for a YouTube video?
According to the docs: The uniques metric was deprecated on September 27, 2016. It is not a core metric and will be supported until October 31, 2016.
But it is still present in the Studio Interface as described in the page of the Help Center
Solution 1:[1]
Go on your Video analytics interface in YouTube Studio.
Open the Network tab of your web-browser by using Ctrl + Shift + E.
Now select Audience, pay attention to select one of following:
Because options:
- Since published
- Last 365 days
- Since uploaded (lifetime)
- Others depending on the time of video upload
Are maybe unavailable (depends on the time of video upload):
Total number of unique viewers is only available for periods of up to 90 days to ensure data quality.
You should see a request to get_screen, copy it as cURL (by right-clicking).
Pay attention to remove -H 'Accept-Encoding: gzip, deflate, br' from it or append | gunzip in order to get the JSON response in a human readable format. Otherwise you would face the following warning:
Warning: Binary output can mess up your terminal. Use "--output -" to tell curl to output it to your terminal anyway, or consider "--output " to save to a file.
In --data-raw request argument --data-raw '{"screenConfig":{"entity":{"videoId":"VIDEO_ID"} pay attention to change the VIDEO_ID for the one interesting you.
Execute the modified cURL request and your unique viewers value is in the JSON response at the key cards/0/keyMetricCardData/keyMetricTabs/1/primaryContent/total.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |

