如何通过YouTube API V3获取订阅者人口统计及位置等详细信息
Hey there! Let's break down exactly what you can (and can't) do with YouTube API v3 to get subscriber demographics, location data, and more detailed subscriber info.
1. Why youtube.subscriptions.list falls short
First off, the subscriptions.list endpoint is designed to fetch metadata about subscription relationships (who subscribed to whom, visibility settings) — not deep subscriber data. The limited fields you're seeing (title, description, channelId) are all that's publicly available for subscribers who've set their subscriptions to public. Even then, this endpoint can't access any personal or demographic details about those subscribers, since YouTube prioritizes user privacy.
2. Get aggregated subscriber stats with YouTube Analytics API
If you want population-level demographics (age/gender) and location distribution for your entire subscriber base, the YouTube Analytics API is the right tool — not the Data API's subscriptions endpoint.
How to use it:
- You'll need OAuth 2.0 authentication (since this is private channel data) and must be the channel owner or an authorized admin.
- Use the
reports.queryendpoint with these key parameters:metrics: ChoosesubscribersDemographicsfor age/gender stats, orsubscribersGeographyfor location datadimensions: Pair withageGroup,gender(for demographics) orcountry(for location)filters: Target your specific channel withchannel==UCXXXXXXXXXXXXXXX
Here's a quick code snippet example using the Google API client library:
// Fetch age/gender breakdown of subscribers const analyticsResponse = await youtubeAnalytics.reports.query({ 'ids': 'channel==UCXXXXXXXXXXXXXXX', 'startDate': '2024-01-01', 'endDate': '2024-06-30', 'metrics': 'subscribersDemographics', 'dimensions': 'ageGroup,gender' });
This will return aggregated stats (e.g., "18-24 year old males make up 25% of subscribers") — no individual user data is exposed, which aligns with privacy regulations like GDPR.
3. Can you get individual subscriber details?
Short answer: No, not for private data like demographics. The only individual subscriber info you can access is:
- Public channel metadata (via
youtube.channels.listusing the channelId fromsubscriptions.list) - If the subscriber has filled out their public channel profile, you might get their publicly listed
countryfield
You will never be able to access a subscriber's age, gender, or private location data — these are protected under YouTube's privacy policies. Also, keep in mind that most subscribers set their subscriptions to private, so subscriptions.list will only show a small subset of your total subscribers.
4. Quick recap
- Aggregate subscriber demographics/location: Use YouTube Analytics API's
reports.queryfor aggregated, privacy-compliant stats. - Individual subscriber info: Only public channel metadata (including public country, if provided) is accessible, and only for subscribers with public subscriptions.
内容的提问来源于stack exchange,提问作者Vicky





