SAMMI Extensions
YouTube Info
Collection of commands to interact with the YouTube API.
Features
- Video Information - get video title, description, view count, like count, thumbnails, license and more
- Video Duration - get video duration in milliseconds, seconds or minutes
- Video Captions - get video captions in different languages, formatted as an array or text, with or without timestamps
- Video Comments - get video comments, including author, comment, like count, published date, replies and more
- Get Playlist Items - get playlist items, including video title, description, published at, thumbnails and more
- Search Videos - search videos by keywords, channel, category, duration and more
Setup
- Install the extension. You can follow the Extension Install Guide.
Uninstall Old Extension
This extension replaced the old 'YouTube Duration' extension. If you have the old extension installed, please uninstall it before installing this one.
- You're all set! You can now use the commands below.
Optional Custom API Key
By default, the YouTube Info Extension uses my provided API key. This key is shared among everyone who installs and uses the extension.
Since the extension only retrieves YouTube video information, you do not need to authenticate on your end.
If you encounter errors like "quota exceeded", you can provide your own API key inside the Settings button.
How To Retrieve Your Own YouTube Data API Key:
- Go to the Google Cloud Console at console.cloud.google.com.
- Create a New Project or use an existing one by clicking 'Select a project'.
- Enable YouTube Data API:
- In the search bar, type "YouTube Data API" and select it.
- Click "Enable" to activate the API for your project.
- Create API Credentials:
- Go to "API & Services" -> "Credentials" tab on the left-hand menu.
- Click "+ Create Credentials" and choose "API Key."
- Your new API key will be generated. Copy paste it into the box below.
Recommended
Click on the key and restrict the key to only work with the "YouTube Data API".
Commands
Command Usage Reminder
These commands require a waiting period before 'Save Variable As' is populated. Use the Wait Until Variable Exists command, and remember to delete the variable you're waiting for beforehand.
Get Video Info
Returns a video information object with details like title, description, view count, like count, thumbnails, license and more.
Auto-Conversion
You can provide a video ID or URL. If you provide a URL, the extension will extract the video ID from it.
Box Name | Description |
---|---|
URL | The video URL you want to get information for. |
ID | The video ID you want to get information for. |
Save Variable As | The variable name to save the video information object as. |
Example response object:
{
"id": "nfRBUCBPwvw",
"title": "Variables in SAMMI | What does the yellow box mean?!",
"description": "Since the original video on...",
"channelId": "UC9uWa-US_jCYmdwTI2sHpMw",
"channelTitle": "Christina K.",
"publishedAt": "2024-08-20T22:46:56Z",
"categoryId": "20",
"viewCount": "47",
"likeCount": "4",
"commentCount": "0",
"favoriteCount": "0",
"embeddable": 1.0,
"embedHtml": "<iframe width=\"480\" height=\"270\" src=\"//www.youtube.com/embed/nfRBUCBPwvw\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen></iframe>",
"madeForKids": 0.0,
"licensedContent": 0.0,
"license": "youtube",
"thumbnails": {
"maxres": {
"url": "https://i.ytimg.com/vi/nfRBUCBPwvw/maxresdefault.jpg",
"width": 1280.0,
"height": 720.0
},
"default": {
"url": "https://i.ytimg.com/vi/nfRBUCBPwvw/default.jpg",
"width": 120.0,
"height": 90.0
},
"medium": {
"url": "https://i.ytimg.com/vi/nfRBUCBPwvw/mqdefault.jpg",
"width": 320.0,
"height": 180.0
},
"standard": {
"url": "https://i.ytimg.com/vi/nfRBUCBPwvw/sddefault.jpg",
"width": 640.0,
"height": 480.0
},
"high": {
"url": "https://i.ytimg.com/vi/nfRBUCBPwvw/hqdefault.jpg",
"width": 480.0,
"height": 360.0
}
}
}
Get Video Duration
Returns the video duration in milliseconds, seconds or minutes.
Auto-Conversion
You can provide a video ID or URL. If you provide a URL, the extension will extract the video ID from it.
Box Name | Description |
---|---|
URL | The video URL you want to get the duration for. |
ID | The video ID you want to get the duration for. |
Format | The format to return the duration in. Options: milliseconds, seconds, minutes. |
Save Variable As | The variable name to save the video duration as. |
Get Video Captions
Retrieves captions for the specified YouTube Video.
Auto-Conversion
You can provide a video ID or URL. If you provide a URL, the extension will extract the video ID from it.
Box Name | Description |
---|---|
URL | The video URL you want to get captions for. |
ID | The video ID you want to get captions for. |
Language | The preferred language code. If not available, will be set to en as English. |
Format | Whether to format the captions into an array or plain text. |
Include Timestamps | Whether to include timestamps or just the captions themselves. |
Save Variable As | The variable name to save the captions as. |
Save Language As | The variable name to save the captions language as. |
Example captions array with timestamps enabled:
[
"0:00 hey samis I'm Christina and today we",
"0:04 will go over what a variable is and how",
"0:08 we use them in",
"0:09 Samy first things first what is a",
"0:14 variable let's ask uh our new friend"
]
Get Video Comments
Retrieves comments for the specified YouTube Video.
Auto-Conversion
You can provide a video ID or URL. If you provide a URL, the extension will extract the video ID from it.
Box Name | Description |
---|---|
URL | The video URL you want to get comments for. |
ID | The video ID you want to get comments for. |
Max Results | The maximum number of comments to return, 0-50. |
Next Page Token | The next page token for pagination. Retrieve from the initial response. |
Save Variable As | The variable name to save the comments as. Returned as an object with items array and nextPageToken . |
Example response object with a single comment and a reply:
{
"nextPageToken": "Z2V0X25ld2VzdF9maXJzdC0tQ2dnSWdBUVZGN2ZST0JJRkNJY2dHQUFTQlFpSUlCZ0FFZ1VJblNBWUFSSUZDSWtnR0FBU0JRaW9JQmdBR0FBaURnb01DSUMzc0pVR0VKRFpzYUFD",
"items": [
{
"commentId": "UgxrNMw_Dhfrz3nHYSJ4AaABAg",
"author": {
"channelId": "UCFtWXvQOwHsHHE5d4c6KwWA",
"channelUrl": "http://www.youtube.com/@BlazenMikay",
"profileImageUrl": "https://yt3.ggpht.com/ytc/AIdro_kPFmb7J_orOqFKMnB7C8rO7GXxNGHgLIwb7A2_EZbKpw=s48-c-k-c0x00ffffff-no-rj",
"displayName": "@BlazenMikay"
},
"text": "so songs request are added into a playlist and not just queued up got it does this still work with sammi?",
"publishedAt": "2024-07-22T20:06:42Z",
"likeCount": 0.0,
"replies": [
{
"commentId": "UgxrNMw_Dhfrz3nHYSJ4AaABAg.A6CioZQUPNNA6DANJYoMLK",
"author": {
"channelId": "UC9uWa-US_jCYmdwTI2sHpMw",
"channelUrl": "http://www.youtube.com/@ChristinnaK",
"profileImageUrl": "https://yt3.ggpht.com/gmoJUD7qhHIDJ6Hh1N049z9E8O4HFdOvxn5paUAotqvH2lKCXWhCnx4KvsiMwos51Idab8m-=s48-c-k-c0x00ffffff-no-rj",
"displayName": "@ChristinnaK"
},
"text": "Song requests are added to the end of your playback queue.",
"publishedAt": "2024-07-23T00:16:15Z",
"likeCount": 0.0
}
]
}
]
}
Search Videos
Search YouTube videos based on query and filters, and return results.
Box Name | Description |
---|---|
Channel ID | Limit videos created by this channel ID. |
Type | The type of resource to return. Automatically set to video if category or duration isn't set to any . |
Category | Restricts the search only to a specific category. |
Duration | Filters the videos based on their duration. |
License | Only include videos with a particular license. |
Max Results | The maximum number of videos to return, 0-50. |
Order | The order in which the videos should return. |
Query | The search query, the term to search for. Can contain boolean NOT (-) and OR (|) parameters. For example, search for cat and rabbit videos: cats|rabbits . Or, search for rabbit videos but not recipes: rabbits -recipes . |
Save Variable As | The variable name to save the search results as. Returned as an array of video objects |
Example Video Object after searching for short rabbits
videos:
{
"videoId": "UcFFrZFQX6w",
"title": "Cute Rabbits Jumping In The Farm#farming",
"description": "in this video How do you befriend a rabbit? rabbit frandship rabbit house rabbit dosti rabbit farming rabbit farm rabbit rabbit ...",
"channelId": "UCbVIs7AaH_e8Y-g8174HhEA",
"channelTitle": "Aastha Rabbit Farming",
"publishedAt": "2024-09-29T04:29:21Z",
"publishTime": "2024-09-29T04:29:21Z",
"liveBroadcastContent": "none",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/UcFFrZFQX6w/default.jpg",
"width": 120.0,
"height": 90.0
},
"medium": {
"url": "https://i.ytimg.com/vi/UcFFrZFQX6w/mqdefault.jpg",
"width": 320.0,
"height": 180.0
},
"high": {
"url": "https://i.ytimg.com/vi/UcFFrZFQX6w/hqdefault.jpg",
"width": 480.0,
"height": 360.0
}
},
"kind": "youtube#video"
}
Get Playlist Items
Retrieves all videos from the specified playlist.
Auto-Conversion
You can provide a video ID or URL. If you provide a URL, the extension will extract the video ID from it.
Box Name | Description |
---|---|
URL | The playlist URL you want to get videos for. |
ID | The playlist ID you want to get videos for. |
Max Results | The maximum number of videos to return, 0-50. |
Next Page Token | The next page token for pagination. Retrieve from the initial response. |
Save Variable As | The variable name to save the playlist items as. Returned as an object with items array and nextPageToken . |
Example response with a single video object:
{
"nextPageToken": "EAAajgFQVDpDQW9pRUVSR1JUSkJNelF6TVRCQ05rSXhOamtvQVVpRmlLUE41OEtJQTFBQldrVWlRMmxLVVZSRVZteGhlbXN4VTIxYVVFeFlhRE5VUmxwdVlsTXhiR014VmpWa01qbHZWREozZEZReVduRmpWekIwUldkM1NYVmxaVmQwZDFsUmFWQlBUekpSVFNJ",
"items": [
{
"videoId": "evj47uRl3Xs",
"title": "Clean the Bunny Room with Me! 🐰🧹",
"description": "Come along with me as I clean my bunnies' room! 🧹🐇 In this video, I’ll show you my routine for keeping my rabbit’s space clean and organized...",
"channelId": "UCMwnCA2CMDQnoQ-UOrwVMUw",
"channelTitle": "Victoria Raechel",
"videoOwnerChannelTitle": "Victoria Raechel",
"videoOwnerChannelId": "UCMwnCA2CMDQnoQ-UOrwVMUw",
"playlistId": "PL5ek95JfO-xwLVgm-esUywohOl-Ofjqm-",
"position": 0.0,
"publishedAt": "2024-09-14T16:03:05Z",
"videoPublishedAt": "2024-09-14T16:00:41Z",
"thumbnails": {
"maxres": {
"url": "https://i.ytimg.com/vi/evj47uRl3Xs/maxresdefault.jpg",
"width": 1280.0,
"height": 720.0
},
"default": {
"url": "https://i.ytimg.com/vi/evj47uRl3Xs/default.jpg",
"width": 120.0,
"height": 90.0
},
"medium": {
"url": "https://i.ytimg.com/vi/evj47uRl3Xs/mqdefault.jpg",
"width": 320.0,
"height": 180.0
},
"standard": {
"url": "https://i.ytimg.com/vi/evj47uRl3Xs/sddefault.jpg",
"width": 640.0,
"height": 480.0
},
"high": {
"url": "https://i.ytimg.com/vi/evj47uRl3Xs/hqdefault.jpg",
"width": 480.0,
"height": 360.0
}
},
"resourceId": {
"kind": "youtube#video",
"videoId": "evj47uRl3Xs"
}
}
]
}
Get Help
Please see Troubleshooting for common extensions issues.