The YouTube API Scratch Extension allows you to interact with the YouTube API directly from Scratch projects. You can retrieve a YouTube channel's subscriber count, view count, and even video descriptions using this extension.
- Set API Key: Configure your API key for accessing YouTube data.
- Get Subscriber Count: Retrieve the subscriber count of a YouTube channel.
- Get Channel Views: Retrieve the total views of a YouTube channel.
- Get Video Description: Retrieve the description of a YouTube video by its video ID.
The extension provides the following blocks:
-
set API key [KEY]
Sets the YouTube API key for subsequent API requests. -
[CHANNEL]'s subscriber count
Reports the subscriber count of the given YouTube channel. -
[CHANNEL]'s total views
Reports the total views of the given YouTube channel. -
description of video id [VIDEOID]
Reports the description of the YouTube video with the provided video ID.
- YouTube API Key: To use this extension, you'll need a valid YouTube Data API v3 key. You can get one from the Google Developer Console.
- Internet Connection: The extension requires an active internet connection to interact with the YouTube API.
- Obtain your YouTube API key from the Google Developer Console.
- Use the
set API key [KEY]block to configure your API key in your Scratch project. - Use the blocks to retrieve information about YouTube channels and videos.
-
Set your API key:
- Use the
set API key [YOUR_API_KEY]block to input your YouTube API key.
- Use the
-
Get a channel's subscriber count:
- Use the
[CHANNEL] 's subscriber countblock to get the number of subscribers of a YouTube channel. Replace[CHANNEL]with the channel's ID.
- Use the
-
Get the total views of a channel:
- Use the
[CHANNEL] 's total viewsblock to get the total view count of a channel.
- Use the
-
Get the description of a video:
- Use the
description of video id [VIDEOID]block to get the description of a YouTube video. Replace[VIDEOID]with the video's unique ID.
- Use the
when green flag clicked
set API key to [YOUR_API_KEY]
set [channel ID v] to [UCSN4-8b7bo3_bz_XRS9ZdBQ]
say (join (Channel ID) (join('s Subscriber count is ) (join ((Channel ID)'s Subscriber Count)
You can use the YouTube API Scratch Extension directly in the TurboWarp editor by following this link:
Use the YouTube API Scratch Extension in TurboWarp
Simply click the link and start using the extension in your project!
- Ensure you use a valid YouTube API key. Without a key, the blocks will not work.
- The default values for channel ID and video ID are set to some common examples for easy testing.
- You may encounter API rate limits depending on your usage. Ensure you stay within the API quota limits set by Google.
This project is open-source and licensed under the MIT License.