Usage for YouTube¶
YouTube is a video sharing platform that allows users to upload, view, and share videos. Agoras provides full support for uploading videos to YouTube, as well as liking and deleting videos via the YouTube Data API v3.
Note
Agoras uses agoras youtube for YouTube operations.
See the migration guide for upgrading from agoras publish.
Added in version 2.0: OAuth 2.0 “authorize first” workflow
Required Credentials¶
Before using Agoras with YouTube, you’ll need to obtain the following credentials from the Google Cloud Console:
Client ID (
YOUTUBE_CLIENT_ID): Your Google OAuth 2.0 Client IDClient Secret (
YOUTUBE_CLIENT_SECRET): Your Google OAuth 2.0 Client Secret
See Google credentials for detailed instructions on how to set up your Google Cloud project, enable the YouTube Data API v3, and obtain these credentials.
Available Actions¶
authorize- Set up OAuth 2.0 authentication (required first step)video- Upload and publish a video to YouTubelike- Like a YouTube videodelete- Delete a YouTube video
Upload a video to YouTube¶
This command uploads a video file from a local path or a remote URL to your YouTube channel.
Note
You must run agoras youtube authorize first before using this command.
New format:
agoras youtube video \
--video-url "${VIDEO_URL}" \
--title "My Awesome Video" \
--description "This is a video description" \
--category-id "22" \
--privacy "public" \
--keywords "awesome,video,agoras"
Parameters:
--video-url(required): Local file path or public URL of the video to upload.--title(optional): The title of the video.--description(optional): The description of the video.--category-id(optional): The numeric YouTube category ID (e.g.,22for People & Blogs,28for Science & Technology).--privacy(optional): Video privacy status. Choices arepublic,private, orunlisted(default:private).--keywords(optional): Comma-separated list of keywords/tags for the video.
Like a YouTube video¶
You can like a specific video on YouTube by providing its video ID.
Note
You must run agoras youtube authorize first before using this command.
New format:
agoras youtube like \
--video-id "${VIDEO_ID}"
Delete a YouTube video¶
You can delete a specific video from your channel by providing its video ID.
Note
You must run agoras youtube authorize first before using this command.
New format:
agoras youtube delete \
--video-id "${VIDEO_ID}"
Post the last video from an RSS feed into YouTube¶
This command will parse an RSS feed located at --feed-url, extract video URLs from the feed entries, and upload them to YouTube.
Note
You must run agoras youtube authorize first before using this command.
Please read about how the RSS feed should be structured in the RSS feed section.
agoras utils feed-publish \
--network "youtube" \
--mode "last" \
--youtube-client-id "${YOUTUBE_CLIENT_ID}" \
--youtube-client-secret "${YOUTUBE_CLIENT_SECRET}" \
--feed-url "${FEED_URL}" \
--max-count "${MAX_COUNT}" \
--post-lookback "${POST_LOOKBACK}"
Scheduling YouTube video publishing¶
You can schedule video publishing from a Google Sheet that contains video paths/URLs and descriptions.
Note
You must run agoras youtube authorize first before using this command.
See Using Agoras and Google credentials for how to configure and authorize Google Sheets.
agoras utils schedule \
--spreadsheet-id "${SPREADSHEET_ID}" \
--sheet-name "${SHEET_NAME}" \
--youtube-client-id "${YOUTUBE_CLIENT_ID}" \
--youtube-client-secret "${YOUTUBE_CLIENT_SECRET}"