-
Notifications
You must be signed in to change notification settings - Fork 0
YouTube Data API
Astro utilizes the YouTube Data API for data collection. In order to use the API, you need to create an API key.
The steps I used are:
- Login to Google Developers Console.
- Create a new project.
- On the new project dashboard, click Enable APIs and Services.
- In the library, navigate to YouTube Data API v3 under YouTube APIs.
- Click the YouTube Data API v3 tile, and enable the API on the next screen.
- Create credentials.
- A screen will appear with the API key.
Helpful information about the API.
The YouTube Data API works on a quota system, restricting API usage for each user per 24 hour period in order to protect service quality. In a 24 hour period, an API user is not allowed 10,000 quotas. Each API call has a different quota cost, which can be viewed here. Astro is currently only performing read (or 'list') operations, which are the cheapest API calls, costing just 1 quota each. Therefore, it is unlikely that data collection with Astro with ever meet/exceed this quota limit.
The commentCount
field returned in the API response for video metadata is not always accurate.
I noticed this while working on adding a progress bar for downloading comments from a video, since I was planning to use the comment count as the 'width' or 'step count' of the progress bar (250 comments = 250 steps on the progress bar, reading 50 comments means advancing the progress bar 50 steps). When running some tests against a video with 336 comments, I noticed that my code would download 330 and then stop, leaving my progress bar to wait infinitely without completing. Thinking this was a bug in my code, I checked the dataframe constructed from the comment data, and it reflected 330.
Some online reading indicated that this may be because the mysterious 6 missing comments had some kind of moderative action taken against them. This could include:
- Filtering rules
- The video's author has filtering rules in place which block comments containing certain words/strings. When these comments get filtered out, then become invisible to every other user besides the comment author.
- YouTube moderation
- The comment was detected/flagged by YouTube's automated moderation service, restricting visibility of the comment.
- If the video's author has blocked the user attempting to comment, it seems said comment would still be included in the overall count, but its visibility is restricted.