Add Youtube-Node (#717)

*  Youtube-Node

*  Small improvement

*  Improvements

*  Improvements

* zap: Improvements

Co-authored-by: Jan <janober@users.noreply.github.com>
This commit is contained in:
Jan 2020-08-16 09:39:40 +02:00 committed by GitHub
commit 07973020f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 5384 additions and 0 deletions

View file

@ -0,0 +1,29 @@
import {
ICredentialType,
NodePropertyTypes,
} from 'n8n-workflow';
//https://developers.google.com/youtube/v3/guides/auth/client-side-web-apps#identify-access-scopes
const scopes = [
'https://www.googleapis.com/auth/youtube',
'https://www.googleapis.com/auth/youtubepartner',
'https://www.googleapis.com/auth/youtube.force-ssl',
'https://www.googleapis.com/auth/youtube.upload',
'https://www.googleapis.com/auth/youtubepartner-channel-audit',
];
export class YouTubeOAuth2Api implements ICredentialType {
name = 'youTubeOAuth2Api';
extends = [
'googleOAuth2Api',
];
displayName = 'Google OAuth2 API';
properties = [
{
displayName: 'Scope',
name: 'scope',
type: 'hidden' as NodePropertyTypes,
default: scopes.join(' '),
},
];
}

View file

@ -0,0 +1,586 @@
import {
INodeProperties,
} from 'n8n-workflow';
export const channelOperations = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
displayOptions: {
show: {
resource: [
'channel',
],
},
},
options: [
{
name: 'Get',
value: 'get',
description: 'Retrieve a channel',
},
{
name: 'Get All',
value: 'getAll',
description: 'Retrieve all channels',
},
{
name: 'Update',
value: 'update',
description: 'Update a channel',
},
{
name: 'Upload Banner',
value: 'uploadBanner',
description: 'Upload a channel banner',
}
],
default: 'getAll',
description: 'The operation to perform.'
}
] as INodeProperties[];
export const channelFields = [
/* -------------------------------------------------------------------------- */
/* channel:getAll */
/* -------------------------------------------------------------------------- */
{
displayName: 'Fields',
name: 'part',
type: 'multiOptions',
options: [
{
name: '*',
value: '*',
},
{
name: 'Branding Settings',
value: 'brandingSettings',
},
{
name: 'Content Details',
value: 'contentDetails',
},
{
name: 'Content Owner Details',
value: 'contentOwnerDetails',
},
{
name: 'ID',
value: 'id',
},
{
name: 'Localizations',
value: 'localizations',
},
{
name: 'Snippet',
value: 'snippet',
},
{
name: 'Statistics',
value: 'statistics',
},
{
name: 'Status',
value: 'status',
},
{
name: 'Topic Details',
value: 'topicDetails',
},
],
required: true,
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'channel',
],
},
},
description: 'The fields parameter specifies a comma-separated list of one or more channel resource properties that the API response will include.',
default: ['*'],
},
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'channel',
],
},
},
default: false,
description: 'If all results should be returned or only up to a given limit.',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'channel',
],
returnAll: [
false,
],
},
},
typeOptions: {
minValue: 1,
maxValue: 50,
},
default: 25,
description: 'How many results to return.',
},
{
displayName: 'Filters',
name: 'filters',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'channel',
],
},
},
options: [
{
displayName: 'Category ID',
name: 'categoryId',
type: 'string',
default: '',
description: 'The categoryId parameter specifies a YouTube guide category, thereby requesting YouTube channels associated with that category.',
},
{
displayName: 'For Username',
name: 'forUsername',
type: 'string',
default: '',
description: `The forUsername parameter specifies a YouTube username, thereby requesting the channel associated with that username.`,
},
{
displayName: 'ID',
name: 'id',
type: 'string',
default: '',
description: `The id parameter specifies a comma-separated list of the YouTube channel ID(s) for the resource(s) that are being retrieved. In a channel resource, the id property specifies the channel's YouTube channel ID.`,
},
{
displayName: 'Managed By Me',
name: 'managedByMe',
type: 'boolean',
default: false,
description: `Set this parameter's value to true to instruct the API to only return channels managed by the content owner that the onBehalfOfContentOwner parameter specifies`,
},
],
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'channel',
],
},
},
options: [
{
displayName: 'Language Code',
name: 'h1',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getLanguages'
},
default: '',
description: `The hl parameter instructs the API to retrieve localized resource metadata for a specific application language that the YouTube website supports.`,
},
{
displayName: 'On Behalf Of Content Owner',
name: 'onBehalfOfContentOwner',
type: 'string',
default: '',
description: `The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value`,
},
],
},
/* -------------------------------------------------------------------------- */
/* channel:get */
/* -------------------------------------------------------------------------- */
{
displayName: 'Channel ID',
name: 'channelId',
type: 'string',
required: true,
displayOptions: {
show: {
operation: [
'get',
],
resource: [
'channel',
],
},
},
description: 'ID of the video',
default: '',
},
{
displayName: 'Fields',
name: 'part',
type: 'multiOptions',
options: [
{
name: '*',
value: '*',
},
{
name: 'Branding Settings',
value: 'brandingSettings',
},
{
name: 'Content Details',
value: 'contentDetails',
},
{
name: 'Content Owner Details',
value: 'contentOwnerDetails',
},
{
name: 'ID',
value: 'id',
},
{
name: 'Localizations',
value: 'localizations',
},
{
name: 'Snippet',
value: 'snippet',
},
{
name: 'Statistics',
value: 'statistics',
},
{
name: 'Status',
value: 'status',
},
{
name: 'Topic Details',
value: 'topicDetails',
},
],
required: true,
displayOptions: {
show: {
operation: [
'get',
],
resource: [
'channel',
],
},
},
description: 'The fields parameter specifies a comma-separated list of one or more channel resource properties that the API response will include.',
default: ['*'],
},
/* -------------------------------------------------------------------------- */
/* channel:update */
/* -------------------------------------------------------------------------- */
{
displayName: 'Channel ID',
name: 'channelId',
type: 'string',
required: true,
displayOptions: {
show: {
operation: [
'update',
],
resource: [
'channel',
],
},
},
default: '',
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
operation: [
'update',
],
resource: [
'channel',
],
},
},
options: [
{
displayName: 'Branding Settings',
name: 'brandingSettingsUi',
type: 'fixedCollection',
default: {},
description: 'Encapsulates information about the branding of the channel.',
placeholder: 'Add Branding Settings',
typeOptions: {
multipleValues: false,
},
options: [
{
name: 'channelSettingsValues',
displayName: 'Channel Settings',
values: [
{
displayName: 'Channel',
name: 'channel',
type: 'collection',
default: '',
placeholder: 'Add Channel Settings',
typeOptions: {
multipleValues: false,
},
options: [
{
displayName: 'Country',
name: 'country',
type: 'string',
default: '',
description: 'The country with which the channel is associated. Update this property to set the value of the snippet.country property.',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
description: `The channel description, which appears in the channel information box on your channel page. The property's value has a maximum length of 1000 characters.`,
},
{
displayName: 'Default Language',
name: 'defaultLanguage',
type: 'string',
default: '',
description: 'The content tab that users should display by default when viewers arrive at your channel page.',
},
{
displayName: 'Default Tab',
name: 'defaultTab',
type: 'string',
default: 'The content tab that users should display by default when viewers arrive at your channel page.',
},
{
displayName: 'Featured Channels Title',
name: 'featuredChannelsTitle',
type: 'string',
default: '',
description: 'The title that displays above the featured channels module. The title has a maximum length of 30 characters.',
},
{
displayName: 'Featured Channels Urls',
name: 'featuredChannelsUrls',
type: 'string',
typeOptions: {
multipleValues: true,
},
description: 'A list of up to 100 channels that you would like to link to from the featured channels module. The property value is a list of YouTube channel ID values, each of which uniquely identifies a channel.',
default: [],
},
{
displayName: 'Keywords',
name: 'keywords',
type: 'string',
typeOptions: {
alwaysOpenEditWindow: true,
},
placeholder: 'tech,news',
description: 'Keywords associated with your channel. The value is a space-separated list of strings.',
default: '',
},
{
displayName: 'Moderate Comments',
name: 'moderateComments',
type: 'boolean',
description: 'This setting determines whether user-submitted comments left on the channel page need to be approved by the channel owner to be publicly visible.',
default: false,
},
{
displayName: 'Profile Color',
name: 'profileColor',
type: 'string',
default: '',
description: `A prominent color that complements the channel's content.`,
},
{
displayName: 'Show Related Channels',
name: 'showRelatedChannels',
type: 'boolean',
description: 'This setting indicates whether YouTube should show an algorithmically generated list of related channels on your channel page.',
default: false,
},
{
displayName: 'Show Browse View',
name: 'showBrowseView',
type: 'boolean',
description: 'This setting indicates whether the channel page should display content in a browse or feed view.',
default: false,
},
{
displayName: 'Tracking Analytics AccountId',
name: 'trackingAnalyticsAccountId',
type: 'string',
description: 'The ID for a Google Analytics account that you want to use to track and measure traffic to your channel.',
default: '',
},
{
displayName: 'Unsubscribed Trailer',
name: 'unsubscribedTrailer',
type: 'string',
description: `The video that should play in the featured video module in the channel page's browse view for unsubscribed viewers.`,
default: '',
},
],
},
],
description: 'The channel object encapsulates branding properties of the channel page',
},
{
name: 'imageSettingsValues',
displayName: 'Image Settings',
values: [
{
displayName: 'Image',
name: 'image',
type: 'collection',
default: '',
placeholder: 'Add Channel Settings',
description: `The image object encapsulates information about images that display on the channel's channel page or video watch pages.`,
typeOptions: {
multipleValues: false,
},
options: [
{
displayName: 'Banner External Url',
name: 'bannerExternalUrl',
type: 'string',
default: '',
},
{
displayName: 'Tracking Image Url',
name: 'trackingImageUrl',
type: 'string',
default: '',
},
{
displayName: 'watch Icon Image Url',
name: 'watchIconImageUrl',
type: 'string',
default: '',
},
],
},
],
},
{
name: 'statusValue',
displayName: 'Status',
values: [
{
displayName: 'Status',
name: 'status',
type: 'collection',
default: '',
placeholder: 'Add Status',
typeOptions: {
multipleValues: false,
},
options: [
{
displayName: 'Self Declared Made For Kids',
name: 'selfDeclaredMadeForKids',
type: 'boolean',
default: false,
},
],
},
],
},
],
},
{
displayName: 'On Behalf Of Content Owner',
name: 'onBehalfOfContentOwner',
type: 'string',
default: '',
},
],
},
/* -------------------------------------------------------------------------- */
/* channel:uploadBanner */
/* -------------------------------------------------------------------------- */
{
displayName: 'Channel ID',
name: 'channelId',
type: 'string',
required: true,
displayOptions: {
show: {
operation: [
'uploadBanner',
],
resource: [
'channel',
],
},
},
description: 'ID of the channel',
default: '',
},
{
displayName: 'Binary Property',
name: 'binaryProperty',
type: 'string',
required: true,
displayOptions: {
show: {
operation: [
'uploadBanner',
],
resource: [
'channel',
],
},
},
default: 'data',
},
] as INodeProperties[];

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,78 @@
import {
OptionsWithUri,
} from 'request';
import {
IExecuteFunctions,
IExecuteSingleFunctions,
ILoadOptionsFunctions,
} from 'n8n-core';
import {
IDataObject,
} from 'n8n-workflow';
export async function googleApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
let options: OptionsWithUri = {
headers: {
'Content-Type': 'application/json',
},
method,
body,
qs,
uri: uri || `https://www.googleapis.com${resource}`,
json: true
};
try {
options = Object.assign({}, options, option);
if (Object.keys(body).length === 0) {
delete options.body;
}
//@ts-ignore
return await this.helpers.requestOAuth2.call(this, 'youTubeOAuth2Api', options);
} catch (error) {
let errors;
if (error.response && error.response.body) {
if (resource === '/upload/youtube/v3/videos') {
error.response.body = JSON.parse(error.response.body);
}
if (error.response.body.error) {
errors = error.response.body.error.errors;
errors = errors.map((e: IDataObject) => e.message);
}
// Try to return the error prettier
throw new Error(
`YouTube error response [${error.statusCode}]: ${errors.join('|')}`
);
}
throw error;
}
}
export async function googleApiRequestAllItems(this: IExecuteFunctions | ILoadOptionsFunctions, propertyName: string ,method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
const returnData: IDataObject[] = [];
let responseData;
query.maxResults = 100;
do {
responseData = await googleApiRequest.call(this, method, endpoint, body, query);
query.pageToken = responseData['nextPageToken'];
returnData.push.apply(returnData, responseData[propertyName]);
} while (
responseData['nextPageToken'] !== undefined &&
responseData['nextPageToken'] !== ''
);
return returnData;
}

View file

@ -0,0 +1,571 @@
import {
INodeProperties,
} from 'n8n-workflow';
export const playlistOperations = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
displayOptions: {
show: {
resource: [
'playlist',
],
},
},
options: [
{
name: 'Create',
value: 'create',
description: 'Create a playlist',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a playlist',
},
{
name: 'Get',
value: 'get',
description: 'Get a playlist',
},
{
name: 'Get All',
value: 'getAll',
description: 'Retrieve all playlists',
},
{
name: 'Update',
value: 'update',
description: 'Update a playlist',
},
],
default: 'getAll',
description: 'The operation to perform.'
}
] as INodeProperties[];
export const playlistFields = [
/* -------------------------------------------------------------------------- */
/* playlist:create */
/* -------------------------------------------------------------------------- */
{
displayName: 'Title',
name: 'title',
type: 'string',
required: true,
displayOptions: {
show: {
operation: [
'create',
],
resource: [
'playlist',
],
},
},
default: '',
description: `The playlist's title.`,
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
operation: [
'create',
],
resource: [
'playlist',
],
},
},
options: [
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
description: `The playlist's description.`,
},
{
displayName: 'Privacy Status',
name: 'privacyStatus',
type: 'options',
options: [
{
name: 'Private',
value: 'private',
},
{
name: 'Public',
value: 'public',
},
{
name: 'Unlisted',
value: 'unlistef',
},
],
default: '',
description: `The playlist's privacy status.`,
},
{
displayName: 'Tags',
name: 'tags',
type: 'string',
default: '',
description: `Keyword tags associated with the playlist. Mulplie can be defined separated by comma`,
},
{
displayName: 'Default Language',
name: 'defaultLanguage',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getLanguages',
},
default: '',
description: `The language of the text in the playlist resource's title and description properties.`,
},
{
displayName: 'On Behalf Of Content Owner Channel',
name: 'onBehalfOfContentOwnerChannel',
type: 'string',
default: '',
description: `The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID of the channel to which a video is being added.<br>
This parameter is required when a request specifies a value for the onBehalfOfContentOwner parameter, and it can only be used in conjunction with that parameter.`,
},
{
displayName: 'On Behalf Of Content Owner',
name: 'onBehalfOfContentOwner',
type: 'string',
default: '',
description: `The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify<br>
a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value`,
},
],
},
/* -------------------------------------------------------------------------- */
/* playlist:get */
/* -------------------------------------------------------------------------- */
{
displayName: 'Playlist ID',
name: 'playlistId',
type: 'string',
required: true,
displayOptions: {
show: {
operation: [
'get',
],
resource: [
'playlist',
],
},
},
default: '',
},
{
displayName: 'Fields',
name: 'part',
type: 'multiOptions',
options: [
{
name: '*',
value: '*',
},
{
name: 'Content Details',
value: 'contentDetails',
},
{
name: 'ID',
value: 'id',
},
{
name: 'Localizations',
value: 'localizations',
},
{
name: 'Player',
value: 'player',
},
{
name: 'Snippet',
value: 'snippet',
},
{
name: 'Status',
value: 'status',
},
],
required: true,
displayOptions: {
show: {
operation: [
'get',
],
resource: [
'playlist',
],
},
},
description: 'The fields parameter specifies a comma-separated list of one or more playlist resource properties that the API response will include.',
default: ['*'],
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
operation: [
'get',
],
resource: [
'playlist',
],
},
},
options: [
{
displayName: 'On Behalf Of Content Owner',
name: 'onBehalfOfContentOwner',
type: 'string',
default: '',
description: `The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify<br>
a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value`,
},
{
displayName: 'On Behalf Of Content Owner Channel',
name: 'onBehalfOfContentOwnerChannel',
type: 'string',
default: '',
description: `The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID of the channel to which a video is being added`,
},
],
},
/* -------------------------------------------------------------------------- */
/* playlist:delete */
/* -------------------------------------------------------------------------- */
{
displayName: 'Playlist ID',
name: 'playlistId',
type: 'string',
required: true,
displayOptions: {
show: {
operation: [
'delete',
],
resource: [
'playlist',
],
},
},
default: '',
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
operation: [
'delete',
],
resource: [
'playlist',
],
},
},
options: [
{
displayName: 'On Behalf Of Content Owner',
name: 'onBehalfOfContentOwner',
type: 'string',
default: '',
description: `The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify<br>
a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value`,
},
],
},
/* -------------------------------------------------------------------------- */
/* playlist:getAll */
/* -------------------------------------------------------------------------- */
{
displayName: 'Fields',
name: 'part',
type: 'multiOptions',
options: [
{
name: '*',
value: '*',
},
{
name: 'Content Details',
value: 'contentDetails',
},
{
name: 'ID',
value: 'id',
},
{
name: 'Localizations',
value: 'localizations',
},
{
name: 'Player',
value: 'player',
},
{
name: 'Snippet',
value: 'snippet',
},
{
name: 'Status',
value: 'status',
},
],
required: true,
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'playlist',
],
},
},
description: 'The fields parameter specifies a comma-separated list of one or more playlist resource properties that the API response will include.',
default: ['*'],
},
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'playlist',
],
},
},
default: false,
description: 'If all results should be returned or only up to a given limit.',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'playlist',
],
returnAll: [
false,
],
},
},
typeOptions: {
minValue: 1,
maxValue: 50,
},
default: 25,
description: 'How many results to return.',
},
{
displayName: 'Filters',
name: 'filters',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'playlist',
],
},
},
options: [
{
displayName: 'Channel ID',
name: 'channelId',
type: 'string',
default: '',
description: `This value indicates that the API should only return the specified channel's playlists.`,
},
{
displayName: 'ID',
name: 'id',
type: 'string',
default: '',
description: `The id parameter specifies a comma-separated list of the YouTube playlist ID(s) for the resource(s) that are being retrieved. In a playlist resource, the id property specifies the playlist's YouTube playlist ID.`,
},
],
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'playlist',
],
},
},
options: [
{
displayName: 'On Behalf Of Content Owner Channel',
name: 'onBehalfOfContentOwnerChannel',
type: 'string',
default: '',
description: `The onBehalfOfContentOwnerChannel parameter specifies the YouTube channel ID of the channel to which a video is being added.<br>
This parameter is required when a request specifies a value for the onBehalfOfContentOwner parameter, and it can only be used in conjunction with that parameter.`,
},
{
displayName: 'On Behalf Of Content Owner',
name: 'onBehalfOfContentOwner',
type: 'string',
default: '',
description: `The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify<br>
a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value`,
},
],
},
/* -------------------------------------------------------------------------- */
/* playlist:update */
/* -------------------------------------------------------------------------- */
{
displayName: 'Playlist ID',
name: 'playlistId',
type: 'string',
required: true,
displayOptions: {
show: {
operation: [
'update',
],
resource: [
'playlist',
],
},
},
default: '',
description: `The playlist's title.`,
},
{
displayName: 'Title',
name: 'title',
type: 'string',
required: true,
displayOptions: {
show: {
operation: [
'update',
],
resource: [
'playlist',
],
},
},
default: '',
description: `The playlist's title.`,
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
default: {},
displayOptions: {
show: {
operation: [
'update',
],
resource: [
'playlist',
],
},
},
options: [
{
displayName: 'Default Language',
name: 'defaultLanguage',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getLanguages',
},
default: '',
description: `The language of the text in the playlist resource's title and description properties.`,
},
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
description: `The playlist's description.`,
},
{
displayName: 'On Behalf Of Content Owner',
name: 'onBehalfOfContentOwner',
type: 'string',
default: '',
description: `The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify<br>
a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value`,
},
{
displayName: 'Privacy Status',
name: 'privacyStatus',
type: 'options',
options: [
{
name: 'Private',
value: 'private',
},
{
name: 'Public',
value: 'public',
},
{
name: 'Unlisted',
value: 'unlistef',
},
],
default: '',
description: `The playlist's privacy status.`,
},
{
displayName: 'Tags',
name: 'tags',
type: 'string',
default: '',
description: `Keyword tags associated with the playlist. Mulplie can be defined separated by comma`,
},
],
},
] as INodeProperties[];

View file

@ -0,0 +1,408 @@
import {
INodeProperties,
} from 'n8n-workflow';
export const playlistItemOperations = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
displayOptions: {
show: {
resource: [
'playlistItem',
],
},
},
options: [
{
name: 'Add',
value: 'add',
description: 'Add an item to a playlist',
},
{
name: 'Delete',
value: 'delete',
description: 'Delete a item from a playlist',
},
{
name: 'Get',
value: 'get',
description: `Get a playlist's item`,
},
{
name: 'Get All',
value: 'getAll',
description: 'Retrieve all playlist items',
},
],
default: 'add',
description: 'The operation to perform.'
}
] as INodeProperties[];
export const playlistItemFields = [
/* -------------------------------------------------------------------------- */
/* playlistItem:add */
/* -------------------------------------------------------------------------- */
{
displayName: 'Playlist ID',
name: 'playlistId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getPlaylists',
},
required: true,
displayOptions: {
show: {
operation: [
'add',
],
resource: [
'playlistItem',
],
},
},
default: '',
},
{
displayName: 'Video ID',
name: 'videoId',
type: 'string',
required: true,
displayOptions: {
show: {
operation: [
'add',
],
resource: [
'playlistItem',
],
},
},
default: '',
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
operation: [
'add',
],
resource: [
'playlistItem',
],
},
},
options: [
{
displayName: 'Position',
name: 'position',
type: 'number',
typeOptions: {
minValue: 0,
},
default: '',
description: `The order in which the item appears in the playlist. The value uses a zero-based index, so the first item has a position of 0, the second item has a position of 1, and so forth.`,
},
{
displayName: 'Note',
name: 'note',
type: 'string',
default: '',
description: `A user-generated note for this item. The property value has a maximum length of 280 characters.`,
},
{
displayName: 'Start At',
name: 'startAt',
type: 'dateTime',
default: '',
description: `The time, measured in seconds from the start of the video, when the video should start playing.`,
},
{
displayName: 'End At',
name: 'endAt',
type: 'dateTime',
default: '',
description: `The time, measured in seconds from the start of the video, when the video should stop playing.`,
},
{
displayName: 'On Behalf Of Content Owner',
name: 'onBehalfOfContentOwner',
type: 'string',
default: '',
description: `The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify<br>
a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value`,
},
],
},
/* -------------------------------------------------------------------------- */
/* playlistItem:get */
/* -------------------------------------------------------------------------- */
{
displayName: 'Playlist Item ID',
name: 'playlistItemId',
type: 'string',
required: true,
displayOptions: {
show: {
operation: [
'get',
],
resource: [
'playlistItem',
],
},
},
default: '',
},
{
displayName: 'Fields',
name: 'part',
type: 'multiOptions',
options: [
{
name: '*',
value: '*',
},
{
name: 'Content Details',
value: 'contentDetails',
},
{
name: 'ID',
value: 'id',
},
{
name: 'Snippet',
value: 'snippet',
},
{
name: 'Status',
value: 'status',
},
],
required: true,
displayOptions: {
show: {
operation: [
'get',
],
resource: [
'playlistItem',
],
},
},
description: 'The fields parameter specifies a comma-separated list of one or more playlistItem resource properties that the API response will include.',
default: ['*'],
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
operation: [
'get',
],
resource: [
'playlistItem',
],
},
},
options: [
{
displayName: 'On Behalf Of Content Owner',
name: 'onBehalfOfContentOwner',
type: 'string',
default: '',
description: `The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify<br>
a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value`,
},
],
},
/* -------------------------------------------------------------------------- */
/* playlistItem:delete */
/* -------------------------------------------------------------------------- */
{
displayName: 'Playlist Item ID',
name: 'playlistItemId',
type: 'string',
required: true,
displayOptions: {
show: {
operation: [
'delete',
],
resource: [
'playlistItem',
],
},
},
default: '',
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
operation: [
'delete',
],
resource: [
'playlistItem',
],
},
},
options: [
{
displayName: 'On Behalf Of Content Owner',
name: 'onBehalfOfContentOwner',
type: 'string',
default: '',
description: `The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify<br>
a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value`,
},
],
},
/* -------------------------------------------------------------------------- */
/* playlistItem:getAll */
/* -------------------------------------------------------------------------- */
{
displayName: 'Playlist ID',
name: 'playlistId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getPlaylists',
},
required: true,
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'playlistItem',
],
},
},
default: ''
},
{
displayName: 'Fields',
name: 'part',
type: 'multiOptions',
options: [
{
name: '*',
value: '*',
},
{
name: 'Content Details',
value: 'contentDetails',
},
{
name: 'ID',
value: 'id',
},
{
name: 'Snippet',
value: 'snippet',
},
{
name: 'Status',
value: 'status',
},
],
required: true,
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'playlistItem',
],
},
},
description: 'The fields parameter specifies a comma-separated list of one or more playlistItem resource properties that the API response will include.',
default: ['*'],
},
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'playlistItem',
],
},
},
default: false,
description: 'If all results should be returned or only up to a given limit.',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'playlistItem',
],
returnAll: [
false,
],
},
},
typeOptions: {
minValue: 1,
maxValue: 50,
},
default: 25,
description: 'How many results to return.',
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'playlistItem',
],
},
},
options: [
{
displayName: 'On Behalf Of Content Owner',
name: 'onBehalfOfContentOwner',
type: 'string',
default: '',
description: `The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify<br>
a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value`,
},
],
},
] as INodeProperties[];

View file

@ -0,0 +1,95 @@
import {
INodeProperties,
} from 'n8n-workflow';
export const videoCategoryOperations = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
displayOptions: {
show: {
resource: [
'videoCategory',
],
},
},
options: [
{
name: 'Get All',
value: 'getAll',
description: 'Retrieve all video categories',
},
],
default: 'getAll',
description: 'The operation to perform.'
}
] as INodeProperties[];
export const videoCategoryFields = [
/* -------------------------------------------------------------------------- */
/* videoCategory:getAll */
/* -------------------------------------------------------------------------- */
{
displayName: 'Region Code',
name: 'regionCode',
type: 'options',
required: true,
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'videoCategory',
],
},
},
typeOptions: {
loadOptionsMethod: 'getCountriesCodes',
},
default: '',
},
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'videoCategory',
],
},
},
default: false,
description: 'If all results should be returned or only up to a given limit.',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'videoCategory',
],
returnAll: [
false,
],
},
},
typeOptions: {
minValue: 1,
maxValue: 50,
},
default: 25,
description: 'How many results to return.',
},
] as INodeProperties[];

View file

@ -0,0 +1,877 @@
import {
INodeProperties,
} from 'n8n-workflow';
export const videoOperations = [
{
displayName: 'Operation',
name: 'operation',
type: 'options',
displayOptions: {
show: {
resource: [
'video',
],
},
},
options: [
{
name: 'Delete',
value: 'delete',
description: 'Delete a video',
},
{
name: 'Get',
value: 'get',
description: 'Get a video',
},
{
name: 'Get All',
value: 'getAll',
description: 'Retrieve all videos',
},
{
name: 'Rate',
value: 'rate',
description: 'Rate a video',
},
{
name: 'Update',
value: 'update',
description: 'Update a video',
},
{
name: 'Upload',
value: 'upload',
description: 'Upload a video',
},
],
default: 'getAll',
description: 'The operation to perform.'
}
] as INodeProperties[];
export const videoFields = [
/* -------------------------------------------------------------------------- */
/* video:upload */
/* -------------------------------------------------------------------------- */
{
displayName: 'Title',
name: 'title',
type: 'string',
required: true,
displayOptions: {
show: {
operation: [
'upload',
],
resource: [
'video',
],
},
},
default: '',
},
{
displayName: 'Region Code',
name: 'regionCode',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getCountriesCodes',
},
displayOptions: {
show: {
operation: [
'upload',
],
resource: [
'video',
],
},
},
default: '',
},
{
displayName: 'Category ID',
name: 'categoryId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getVideoCategories',
loadOptionsDependsOn: [
'regionCode',
],
},
displayOptions: {
show: {
operation: [
'upload',
],
resource: [
'video',
],
},
},
default: '',
},
{
displayName: 'Binary Property',
name: 'binaryProperty',
type: 'string',
required: true,
displayOptions: {
show: {
operation: [
'upload',
],
resource: [
'video',
],
},
},
default: 'data',
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
operation: [
'upload',
],
resource: [
'video',
],
},
},
options: [
{
displayName: 'Default Language',
name: 'defaultLanguage',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getLanguages',
},
default: '',
description: `The language of the text in the playlist resource's title and description properties.`,
},
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
description: `The playlist's description.`,
},
{
displayName: 'Embeddable',
name: 'embeddable',
type: 'boolean',
default: false,
description: `This value indicates whether the video can be embedded on another website.`,
},
{
displayName: 'License',
name: 'license',
type: 'options',
options: [
{
name: 'Creative Common',
value: 'creativeCommon',
},
{
name: 'Youtube',
value: 'youtube',
},
],
default: '',
description: `The video's license.`,
},
{
displayName: 'Notify Subscribers',
name: 'notifySubscribers',
type: 'boolean',
default: false,
description: `The notifySubscribers parameter indicates whether YouTube should send a notification about the new video to users who subscribe to the video's channel`,
},
{
displayName: 'Privacy Status',
name: 'privacyStatus',
type: 'options',
options: [
{
name: 'Private',
value: 'private',
},
{
name: 'Public',
value: 'public',
},
{
name: 'Unlisted',
value: 'unlistef',
},
],
default: '',
description: `The playlist's privacy status.`,
},
{
displayName: 'Public Stats Viewable',
name: 'publicStatsViewable',
type: 'boolean',
default: true,
description: `This value indicates whether the extended video statistics on the video's watch page are publicly viewable.`,
},
{
displayName: 'Publish At',
name: 'publishAt',
type: 'dateTime',
default: '',
description: `If you set a value for this property, you must also set the status.privacyStatus property to private.`,
},
{
displayName: 'Recording Date',
name: 'recordingDate',
type: 'dateTime',
default: '',
description: `The date and time when the video was recorded`,
},
{
displayName: 'Self Declared Made For Kids',
name: 'selfDeclaredMadeForKids',
type: 'boolean',
default: false,
description: `This value indicates whether the video is designated as child-directed, and it contains the current "made for kids" status of the video`,
},
{
displayName: 'Tags',
name: 'tags',
type: 'string',
default: '',
description: `Keyword tags associated with the playlist. Mulplie can be defined separated by comma`,
},
],
},
/* -------------------------------------------------------------------------- */
/* video:delete */
/* -------------------------------------------------------------------------- */
{
displayName: 'Video ID',
name: 'videoId',
type: 'string',
required: true,
displayOptions: {
show: {
operation: [
'delete',
],
resource: [
'video',
],
},
},
description: 'ID of the video',
default: '',
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
operation: [
'delete',
],
resource: [
'video',
],
},
},
options: [
{
displayName: 'On Behalf Of Content Owner',
name: 'onBehalfOfContentOwner',
type: 'string',
default: '',
description: `The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify<br>
a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value`,
},
],
},
/* -------------------------------------------------------------------------- */
/* video:get */
/* -------------------------------------------------------------------------- */
{
displayName: 'Video ID',
name: 'videoId',
type: 'string',
required: true,
displayOptions: {
show: {
operation: [
'get',
],
resource: [
'video',
],
},
},
default: ''
},
{
displayName: 'Fields',
name: 'part',
type: 'multiOptions',
options: [
{
name: '*',
value: '*',
},
{
name: 'Content Details',
value: 'contentDetails',
},
{
name: 'ID',
value: 'id',
},
{
name: 'Live Streaming Details',
value: 'liveStreamingDetails',
},
{
name: 'Localizations',
value: 'localizations',
},
{
name: 'Player',
value: 'player',
},
{
name: 'Recording Details',
value: 'recordingDetails',
},
{
name: 'Snippet',
value: 'snippet',
},
{
name: 'Statistics',
value: 'statistics',
},
{
name: 'Status',
value: 'status',
},
{
name: 'Topic Details',
value: 'topicDetails',
},
],
required: true,
displayOptions: {
show: {
operation: [
'get',
],
resource: [
'video',
],
},
},
description: 'The fields parameter specifies a comma-separated list of one or more video resource properties that the API response will include.',
default: ['*'],
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
operation: [
'get',
],
resource: [
'video',
],
},
},
options: [
{
displayName: 'On Behalf Of Content Owner',
name: 'onBehalfOfContentOwner',
type: 'string',
default: '',
description: `The onBehalfOfContentOwner parameter indicates that the request's authorization credentials identify<br>
a YouTube CMS user who is acting on behalf of the content owner specified in the parameter value`,
},
],
},
/* -------------------------------------------------------------------------- */
/* video:getAll */
/* -------------------------------------------------------------------------- */
{
displayName: 'Return All',
name: 'returnAll',
type: 'boolean',
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'video',
],
},
},
default: false,
description: 'If all results should be returned or only up to a given limit.',
},
{
displayName: 'Limit',
name: 'limit',
type: 'number',
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'video',
],
returnAll: [
false,
],
},
},
typeOptions: {
minValue: 1,
maxValue: 50,
},
default: 25,
description: 'How many results to return.',
},
{
displayName: 'Filters',
name: 'filters',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'video',
],
},
},
options: [
{
displayName: 'Channel ID',
name: 'channelId',
type: 'string',
default: '',
description: `The channelId parameter indicates that the API response should only contain resources created by the channel.`,
},
{
displayName: 'For Developer',
name: 'forDeveloper',
type: 'boolean',
default: false,
description: `The forDeveloper parameter restricts the search to only retrieve videos uploaded via the developer's application or website`,
},
{
displayName: 'Published After',
name: 'publishedAfter',
type: 'dateTime',
default: '',
description: `The publishedAfter parameter indicates that the API response should only contain resources created at or after the specified time.`,
},
{
displayName: 'Published Before',
name: 'publishedBefore',
type: 'dateTime',
default: '',
description: `The publishedBefore parameter indicates that the API response should only contain resources created before or at the specified time.`,
},
{
displayName: 'Query',
name: 'q',
type: 'string',
default: '',
description: `The q parameter specifies the query term to search for.`,
},
{
displayName: 'Region Code',
name: 'regionCode',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getCountriesCodes',
},
default: '',
description: `The regionCode parameter instructs the API to select a video chart available in the specified region.`,
},
{
displayName: 'Related To Video ID',
name: 'relatedToVideoId',
type: 'string',
default: '',
description: 'The relatedToVideoId parameter retrieves a list of videos that are related to the video that the parameter value identifies',
},
{
displayName: 'Video Category ID',
name: 'videoCategoryId',
type: 'string',
default: '',
description: `The videoCategoryId parameter identifies the video category for which the chart should be retrieved.`,
},
{
displayName: 'Video Syndicated ',
name: 'videoSyndicated',
type: 'boolean',
default: false,
description: `The videoSyndicated parameter lets you to restrict a search to only videos that can be played outside youtube.com.`,
},
{
displayName: 'Video Type',
name: 'videoType',
type: 'options',
options: [
{
name: 'Any',
value: 'any',
},
{
name: 'Episode',
value: 'episode',
},
{
name: 'Movie',
value: 'movie',
},
],
default: '',
description: `The videoType parameter lets you restrict a search to a particular type of videos`,
},
],
},
{
displayName: 'Options',
name: 'options',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
operation: [
'getAll',
],
resource: [
'video',
],
},
},
options: [
{
displayName: 'Order',
name: 'order',
type: 'options',
options: [
{
name: 'Date',
value: 'date',
},
{
name: 'Relevance',
value: 'relevance',
},
],
default: 'relevance',
},
{
displayName: 'Safe Search',
name: 'safeSearch',
type: 'options',
options: [
{
name: 'Moderate',
value: 'moderate',
description: 'YouTube will filter some content from search results and, at the least, will filter content that is restricted in your locale',
},
{
name: 'none',
value: 'none',
description: 'YouTube will not filter the search result set',
},
{
name: 'Strict',
value: 'strict',
description: 'YouTube will try to exclude all restricted content from the search result set',
},
],
default: '',
},
],
},
/* -------------------------------------------------------------------------- */
/* video:rate */
/* -------------------------------------------------------------------------- */
{
displayName: 'Video ID',
name: 'videoId',
type: 'string',
required: true,
displayOptions: {
show: {
operation: [
'rate',
],
resource: [
'video',
],
},
},
default: '',
},
{
displayName: 'Rating',
name: 'rating',
type: 'options',
displayOptions: {
show: {
operation: [
'rate',
],
resource: [
'video',
],
},
},
options: [
{
name: 'Dislike',
value: 'dislike',
description: 'Records that the authenticated user disliked the video.',
},
{
name: 'Like',
value: 'like',
description: 'Records that the authenticated user liked the video.',
},
{
name: 'None',
value: 'none',
description: 'Removes any rating that the authenticated user had previously set for the video.',
},
],
default: '',
},
/* -------------------------------------------------------------------------- */
/* video:update */
/* -------------------------------------------------------------------------- */
{
displayName: 'Video ID',
name: 'videoId',
type: 'string',
required: true,
displayOptions: {
show: {
operation: [
'update',
],
resource: [
'video',
],
},
},
default: '',
},
{
displayName: 'Title',
name: 'title',
type: 'string',
required: true,
displayOptions: {
show: {
operation: [
'update',
],
resource: [
'video',
],
},
},
default: '',
},
{
displayName: 'Region Code',
name: 'regionCode',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getCountriesCodes',
},
displayOptions: {
show: {
operation: [
'update',
],
resource: [
'video',
],
},
},
default: '',
},
{
displayName: 'Category ID',
name: 'categoryId',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getVideoCategories',
loadOptionsDependsOn: [
'regionCode',
],
},
displayOptions: {
show: {
operation: [
'update',
],
resource: [
'video',
],
},
},
default: '',
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Option',
default: {},
displayOptions: {
show: {
operation: [
'update',
],
resource: [
'video',
],
},
},
options: [
{
displayName: 'Default Language',
name: 'defaultLanguage',
type: 'options',
typeOptions: {
loadOptionsMethod: 'getLanguages',
},
default: '',
description: `The language of the text in the playlist resource's title and description properties.`,
},
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
description: `The playlist's description.`,
},
{
displayName: 'Embeddable',
name: 'embeddable',
type: 'boolean',
default: false,
description: `This value indicates whether the video can be embedded on another website.`,
},
{
displayName: 'License',
name: 'license',
type: 'options',
options: [
{
name: 'Creative Common',
value: 'creativeCommon',
},
{
name: 'Youtube',
value: 'youtube',
},
],
default: '',
description: `The video's license.`,
},
{
displayName: 'Notify Subscribers',
name: 'notifySubscribers',
type: 'boolean',
default: false,
description: `The notifySubscribers parameter indicates whether YouTube should send a notification about the new video to users who subscribe to the video's channel`,
},
{
displayName: 'Privacy Status',
name: 'privacyStatus',
type: 'options',
options: [
{
name: 'Private',
value: 'private',
},
{
name: 'Public',
value: 'public',
},
{
name: 'Unlisted',
value: 'unlistef',
},
],
default: '',
description: `The playlist's privacy status.`,
},
{
displayName: 'Public Stats Viewable',
name: 'publicStatsViewable',
type: 'boolean',
default: true,
description: `This value indicates whether the extended video statistics on the video's watch page are publicly viewable.`,
},
{
displayName: 'Publish At',
name: 'publishAt',
type: 'dateTime',
default: '',
description: `If you set a value for this property, you must also set the status.privacyStatus property to private.`,
},
{
displayName: 'Recording Date',
name: 'recordingDate',
type: 'dateTime',
default: '',
description: `The date and time when the video was recorded`,
},
{
displayName: 'Self Declared Made For Kids',
name: 'selfDeclaredMadeForKids',
type: 'boolean',
default: false,
description: `This value indicates whether the video is designated as child-directed, and it contains the current "made for kids" status of the video`,
},
{
displayName: 'Tags',
name: 'tags',
type: 'string',
default: '',
description: `Keyword tags associated with the playlist. Mulplie can be defined separated by comma`,
},
],
},
] as INodeProperties[];

File diff suppressed because it is too large Load diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

View file

@ -74,6 +74,7 @@
"dist/credentials/GoogleOAuth2Api.credentials.js",
"dist/credentials/GoogleSheetsOAuth2Api.credentials.js",
"dist/credentials/GoogleTasksOAuth2Api.credentials.js",
"dist/credentials/YouTubeOAuth2Api.credentials.js",
"dist/credentials/GumroadApi.credentials.js",
"dist/credentials/HarvestApi.credentials.js",
"dist/credentials/HelpScoutOAuth2Api.credentials.js",
@ -236,6 +237,7 @@
"dist/nodes/Google/Drive/GoogleDrive.node.js",
"dist/nodes/Google/Sheet/GoogleSheets.node.js",
"dist/nodes/Google/Task/GoogleTasks.node.js",
"dist/nodes/Google/YouTube/YouTube.node.js",
"dist/nodes/GraphQL/GraphQL.node.js",
"dist/nodes/Gumroad/GumroadTrigger.node.js",
"dist/nodes/HackerNews/HackerNews.node.js",