@robinpath/youtube
0.1.1Node.jsPublicYouTube module for RobinPath.
YouTube
YouTube module for RobinPath.
Package: @robinpath/youtube | Category: Social Media | Type: Integration
Authentication
youtube.setCredentials "your-credentials"
Call this once at the start of your script before using any other function. Credentials persist for the duration of the script execution.
Use Cases
Use the youtube module when you need to:
- searchVideos -- Use
youtube.searchVideosto perform this operation - getVideo -- Use
youtube.getVideoto perform this operation - listMyVideos -- Use
youtube.listMyVideosto perform this operation - updateVideo -- Use
youtube.updateVideoto perform this operation - deleteVideo -- Use
youtube.deleteVideoto perform this operation
Quick Reference
| Function | Description | Returns |
|---|---|---|
setCredentials | Configure youtube credentials. | object |
searchVideos | searchVideos | object |
getVideo | getVideo | object |
listMyVideos | listMyVideos | object |
updateVideo | updateVideo | object |
deleteVideo | deleteVideo | object |
listChannels | listChannels | object |
getChannelStats | getChannelStats | object |
listPlaylists | listPlaylists | object |
getPlaylist | getPlaylist | object |
createPlaylist | createPlaylist | object |
deletePlaylist | deletePlaylist | object |
listPlaylistItems | listPlaylistItems | object |
addVideoToPlaylist | addVideoToPlaylist | object |
removeFromPlaylist | removeFromPlaylist | object |
listComments | listComments | object |
addComment | addComment | object |
replyToComment | replyToComment | object |
setThumbnail | setThumbnail | object |
getVideoCategories | getVideoCategories | object |
listSubscriptions | listSubscriptions | object |
Functions
setCredentials
Configure youtube credentials.
Module: youtube | Returns: object -- API response.
youtube.setCredentials
| Parameter | Type | Required | Description |
|---|---|---|---|
accessToken | string | Yes | accessToken |
searchVideos
searchVideos
Module: youtube | Returns: object -- API response.
youtube.searchVideos
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getVideo
getVideo
Module: youtube | Returns: object -- API response.
youtube.getVideo
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
listMyVideos
listMyVideos
Module: youtube | Returns: object -- API response.
youtube.listMyVideos
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
updateVideo
updateVideo
Module: youtube | Returns: object -- API response.
youtube.updateVideo
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
deleteVideo
deleteVideo
Module: youtube | Returns: object -- API response.
youtube.deleteVideo
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
listChannels
listChannels
Module: youtube | Returns: object -- API response.
youtube.listChannels
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getChannelStats
getChannelStats
Module: youtube | Returns: object -- API response.
youtube.getChannelStats
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
listPlaylists
listPlaylists
Module: youtube | Returns: object -- API response.
youtube.listPlaylists
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getPlaylist
getPlaylist
Module: youtube | Returns: object -- API response.
youtube.getPlaylist
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
createPlaylist
createPlaylist
Module: youtube | Returns: object -- API response.
youtube.createPlaylist
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
deletePlaylist
deletePlaylist
Module: youtube | Returns: object -- API response.
youtube.deletePlaylist
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
listPlaylistItems
listPlaylistItems
Module: youtube | Returns: object -- API response.
youtube.listPlaylistItems
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
addVideoToPlaylist
addVideoToPlaylist
Module: youtube | Returns: object -- API response.
youtube.addVideoToPlaylist
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
removeFromPlaylist
removeFromPlaylist
Module: youtube | Returns: object -- API response.
youtube.removeFromPlaylist
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
listComments
listComments
Module: youtube | Returns: object -- API response.
youtube.listComments
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
addComment
addComment
Module: youtube | Returns: object -- API response.
youtube.addComment
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
replyToComment
replyToComment
Module: youtube | Returns: object -- API response.
youtube.replyToComment
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
setThumbnail
setThumbnail
Module: youtube | Returns: object -- API response.
youtube.setThumbnail
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
getVideoCategories
getVideoCategories
Module: youtube | Returns: object -- API response.
youtube.getVideoCategories
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
listSubscriptions
listSubscriptions
Module: youtube | Returns: object -- API response.
youtube.listSubscriptions
| Parameter | Type | Required | Description |
|---|---|---|---|
input | string | No | Input parameter |
Error Handling
All functions throw on failure. Common errors:
| Error | Cause |
|---|---|
Youtube API error (${res.status}): ${t} | Check the error message for details |
youtube.setCredentials requires accessToken. | Check the error message for details |
youtube.updateVideo requires an ID. | Check the error message for details |
youtube.deleteVideo requires an ID. | Check the error message for details |
youtube.deletePlaylist requires an ID. | Check the error message for details |
youtube.removeFromPlaylist requires an ID. | Check the error message for details |
Youtube: "..." not configured. Call youtube.setCredentials first. | Check the error message for details |
@desc "Search videos and validate result"
do
set $result as youtube.searchVideos
if $result != null
print "Success"
else
print "No result"
end
enddo
Recipes
1. List and iterate Video
Retrieve all items and loop through them.
@desc "Setup authentication"
do
youtube.setCredentials $token
enddo
@desc "Get video and iterate results"
do
set $result as youtube.getVideo
each $item in $result
print $item
end
enddo
2. Create a new item with createPlaylist
Create a new resource and capture the result.
@desc "Setup authentication"
do
youtube.setCredentials $token
enddo
@desc "Create playlist"
do
set $result as youtube.createPlaylist
print "Created: " + $result
enddo
3. Create and update workflow
Create an item and then update it.
@desc "Setup authentication"
do
youtube.setCredentials $token
enddo
@desc "Create playlist and update video"
do
set $created as youtube.createPlaylist
# Update the created item
youtube.updateVideo
enddo
4. Check before creating
List existing items and only create if needed.
@desc "Setup authentication"
do
youtube.setCredentials $token
enddo
@desc "Get video and create playlist"
do
set $existing as youtube.getVideo
if $existing == null
youtube.createPlaylist
print "Item created"
else
print "Item already exists"
end
enddo
5. Multi-step YouTube workflow
Chain multiple youtube operations together.
@desc "Setup authentication"
do
youtube.setCredentials $token
enddo
@desc "Search videos, get video, and more"
do
set $r_searchVideos as youtube.searchVideos
set $r_getVideo as youtube.getVideo
set $r_listMyVideos as youtube.listMyVideos
print "All operations complete"
enddo
6. Safe searchVideos with validation
Check results before proceeding.
@desc "Setup authentication"
do
youtube.setCredentials $token
enddo
@desc "Search videos and validate result"
do
set $result as youtube.searchVideos
if $result != null
print "Success: " + $result
else
print "Operation returned no data"
end
enddo
Related Modules
- facebook -- Facebook module for complementary functionality
- instagram -- Instagram module for complementary functionality
- twitter -- Twitter/X module for complementary functionality
- linkedin -- LinkedIn module for complementary functionality
- tiktok -- TikTok module for complementary functionality
Versions (1)
| Version | Tag | Published |
|---|---|---|
| 0.1.1 | latest | 1 months ago |
Related Modules
activecampaign
JS@robinpathv0.1.2
ActiveCampaign -- contacts, automations, campaigns, deals, lists, and tags via the ActiveCampaign REST API v3.
brevo
JS@robinpathv0.1.2
Brevo module for RobinPath.
convertkit
JS@robinpathv0.1.1
Convertkit module for RobinPath.
@robinpathv0.1.1
Facebook module for RobinPath.
$ robinpath add @robinpath/youtube
