Video
This component acts as a bridge between your Nappai automation workflows and the YouTube platform. It enables you to perform various management tasks, such as uploading videos, retrieving video details (like titles, descriptions, and statistics), and managing privacy settings. By using this component, you can automate the handling of YouTube content without needing to write complex code or manually interact with the YouTube interface.
How it Works
The component connects to the YouTube Data API v3 using a secure credential you configure in your Nappai panel. Once connected, it can perform specific actions based on the inputs you provide.
Internally, it constructs a request to YouTube’s servers with the details you supply (such as a Video ID, Title, or Category). It then processes the response from YouTube, extracting relevant information like video statistics, thumbnail URLs, or confirmation of upload success. If something goes wrong (for example, if a video ID is invalid or you lack permission), it provides an error message so you can troubleshoot the issue.
Connection & Credentials
This component requires configuring a credential in the Nappai panel before interacting with the external service:
- Go to the Credentials section in your Nappai panel.
- Create a new credential of the type Youtube API.
- Fill in the required fields:
- Select Project: Choose your Google Cloud Project.
- Client Id: Enter your Google Cloud Project Client Id.
- Client Secret: Enter your Google Cloud Project Client Secret.
- Youtube access: Select the appropriate access level.
- In your workflow, select the saved credential in the Credential input field of this node.
Inputs
This component has a special mode called “Mapping Mode”. When you enable this mode using the toggle switch, an additional input called “Mapping Data” is activated, and each input field offers you three different ways to provide data:
- Fixed: You type the value directly into the field.
- Mapped: You connect the output of another component to use its result as the value.
- Javascript: You write Javascript code to dynamically calculate the value.
This flexibility allows you to create more dynamic and connected workflows.
Input Fields
The following fields are available to configure this component. Each field may be visible in different operations:
- Operation: Choose the type of action you want to perform on the YouTube platform.
- Old Region: The previous region setting of the video, used when modifying existing video properties.
- Old Video ID: The unique identifier of the video you intend to update or manage.
- Title: The name you want to give to your video.
- Description: The detailed text describing the content of your video.
- Category: The video category (e.g., Education, Entertainment). Note: This depends on the Region selected.
- Language: The primary language of the video, provided by YouTube’s system.
- Region: The geographic region associated with the video, provided by YouTube.
- Binary: The actual video file in binary format that you wish to upload to YouTube.
- Privacy Status: Sets who can view your video.
- Private: Only you can view it.
- Unlisted: Anyone with the link can view it, but it won’t appear in search results.
- Public: Anyone can view it, and it will appear in search results.
- Tags: Keywords or tags associated with the video to help with discoverability.
- Make For Kids: A checkbox to declare if the content is made for children.
- Notify Subscribers: A checkbox to send notifications to your subscribers when the video is uploaded. Note: Only works for Public videos.
- Mode: The operational mode for the video action.
- Video ID: The unique ID or URL of the video you want to retrieve or manage.
- Rating: The content rating for the video.
- Get Rating: If you are retrieving rating information, select which type of rating to fetch.
- Max Results: The maximum number of results to return in a list or search operation.
Outputs
The component produces a single output named Result. This output contains the response data from the YouTube API. Depending on the action taken, this data may include video metadata, upload confirmation, error messages, or statistics. You can connect this output to other components in your workflow to process the data further.
Output Data Example (JSON)
json { “kind”: “youtube#video”, “etag”: ""sample_etag_value"", “id”: “dQw4w9WgXcQ”, “snippet”: { “publishedAt”: “2023-10-25T10:00:00.000Z”, “channelId”: “UC_x5XG1OV2P6uZZ5FSM9Ttw”, “title”: “Example Video Title”, “description”: “This is an example video description.”, “thumbnails”: { “default”: { “url”: “https://i.ytimg.com/vi/dQw4w9WgXcQ/default.jpg”, “width”: 120, “height”: 90 }, “high”: { “url”: “https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg”, “width”: 480, “height”: 360 } }, “channelTitle”: “Example Channel”, “categoryId”: “22” }, “statistics”: { “viewCount”: “1000”, “likeCount”: “50”, “dislikeCount”: “0”, “favoriteCount”: “0”, “commentCount”: “10” } }
Connectivity
This component is typically used in workflows involving content management or media processing. It often connects to:
- File Storage Components: Where you retrieve the
Binaryvideo file to be uploaded. - Data Processing Components: To parse the
Resultoutput, extract specific metadata (like View Count or Title), or handle errors. - Email or Notification Components: If you are automating notifications for new video uploads, the success status from this component can trigger alerts.
Usage Example
Scenario: Uploading a New Video
- Retrieve File: Use a previous component to download or locate the video file (
Binaryinput). - Configure Metadata: Enter the
Title,Description, and select aCategoryfor the video. - Set Privacy: Choose
Privacy Statusas “Public” to make it available to all users. - Upload: Select the appropriate
Operation(e.g., Upload) and execute the component. - Verify: Connect the
Resultoutput to a subsequent component to confirm the upload was successful or to log the new Video ID.
Tips and Best Practices
- Check Credentials First: Ensure your Google Cloud Project has the YouTube Data API v3 enabled and that your API credentials are correctly configured in Nappai.
- Use Mapping for Dynamic Data: If your video titles or descriptions come from a database or another part of your workflow, use the “Mapped” option in Input Fields instead of typing them manually.
- Handle Errors Gracefully: Always check the
Resultoutput for errors. If theResultcontains an error message, you can route that path to a logging component or an alert notification. - Respect Privacy Settings: Be careful when setting
Privacy Statusto “Private”. Ensure you have the necessary permissions in your YouTube account to manage private videos. - Use
Max ResultsWisely: When retrieving lists of videos, setMax Resultsto a reasonable number to avoid overwhelming your workflow with too much data at once.
Security Considerations
- API Key Security: Never share your Google Cloud API keys or Client Secrets publicly. Ensure your Nappai credentials are stored securely within the platform.
- Data Privacy: When handling video data, be mindful of copyright laws and YouTube’s terms of service. Ensure you have the right to upload and distribute the content you are managing.
- Access Control: Only grant necessary permissions in your Google Cloud Console. Restrict API access to only the resources (like specific YouTube channels) that your workflow needs to access.