When using the YouTube Data API to scrape non-public YouTube data (like subscribers), you’ll be prompted for a YouTube Access Token to verify that you are who you say you are - and have the right to access the data you’re requesting (e.g. a subscriber list that is only available to the YouTube channel owner).
While you’re welcome to spend 9 hours reading up on Google APIs OAuth 2.0 protocols, scopes, grants, and oh so much more - if you simply need to use the YouTube Data API to download (or scrape) data about your own YouTube channel, then you can skip all of this complexity and follow the steps below to get your YouTube Access Token without the headache.
1. Head to the Playground
Google offers an OAuth 2.0 Playground where you can easily generate a YouTube Access Token based on the Google account you’re logged in to your browser with. Head on over there and we’ll walk you through what to do.
2. Select Your Scope
On the left side of the page, you’ll see a long list of Google products you can request access tokens for. Since we’re only interested in YouTube, just scroll down until you see
YouTube Data API and click that to view the dropdown. Next, select the option for
youtube.readonly and make sure you see a checkmark next to it:
Because we’re picking a “read only” scope, this ensures that in the absolute worst case scenario (if someone takes a photo of your access token over your shoulder), if your token is compromised within the limited time it’s active, the worst someone could do is “read” from your YouTube account. They would not be able to “write” or delete or alter anything in your account. Always pick the scope with the minimum set of permissions you need.
3. Authorize APIs
With the scope selected, now click the blue button labeled
4. Select & Allow Your YouTube Account
On the next screen you’ll see all the YouTube accounts you have access to. Be sure to select the YouTube Account that you want to collect the private data for, and NOT your personal account (unless that’s also the YouTube account you want the data for):
You’ll then be prompted to confirm access to your account. Confirm that it’s “read only” (it will only be able to “View” your YouTube account) and
5. Exchange for Tokens
You’re almost there! On the next screen you’ll see a textbox pre-filled with a security token (you can ignore this), and another blue button labeled
Exchange authorization code for tokens - click this button!
6. Copy Your YouTube Access Token
Now you’ll see the textbox populate with your “Access Token” and will be valid for 1 hour:
Select and copy this value and you’re done!
Using Your YouTube Access Token
Congratulations! You now have your YouTube Access Token and did not need to become an expert in OAuth 2.0! Keep the Playground tab open in your browser, so when the token expires you can simply click the
Refresh access token button to get another one, or you can try checking the
Auto-refresh option to keep the token valid for 24 hours.
To test using your token, you can try to scrape your own list of YouTube Subscribers from the YouTube channel that was selected in step 4. Simply head to this link and set the
mySubscribers parameter to
true, then pass in your YouTube Access Token via the
Authorization HTTP header with the value
Bearer <YOUR_YOUTUBE_ACCESS_TOKEN> to get your list of subscribers back.
If this also sounds like too much work, you can check out the Stevesie Data YouTube Subcribers Integration, which takes care of this for you and lets you download your subscribers as a CSV file without writing any code - just paste in your YouTube Access Token when prompted and you’ll get the subscribers back.