mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-12 21:37:32 -08:00
⚡ Minor improvements to YouTube-Node
This commit is contained in:
parent
07973020f9
commit
9e64409ac6
|
@ -1,6 +1,6 @@
|
||||||
import {
|
import {
|
||||||
OptionsWithUri,
|
OptionsWithUri,
|
||||||
} from 'request';
|
} from 'request';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
IExecuteFunctions,
|
IExecuteFunctions,
|
||||||
|
@ -58,7 +58,7 @@ export async function googleApiRequest(this: IExecuteFunctions | IExecuteSingleF
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function googleApiRequestAllItems(this: IExecuteFunctions | ILoadOptionsFunctions, propertyName: string ,method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
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[] = [];
|
const returnData: IDataObject[] = [];
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,28 @@ export const playlistItemFields = [
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
options: [
|
options: [
|
||||||
|
{
|
||||||
|
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: '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: '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: 'Position',
|
displayName: 'Position',
|
||||||
name: 'position',
|
name: 'position',
|
||||||
|
@ -109,13 +131,6 @@ export const playlistItemFields = [
|
||||||
default: '',
|
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.`,
|
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',
|
displayName: 'Start At',
|
||||||
name: 'startAt',
|
name: 'startAt',
|
||||||
|
@ -123,21 +138,6 @@ export const playlistItemFields = [
|
||||||
default: '',
|
default: '',
|
||||||
description: `The time, measured in seconds from the start of the video, when the video should start playing.`,
|
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`,
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
|
|
|
@ -5,11 +5,11 @@ import {
|
||||||
|
|
||||||
import {
|
import {
|
||||||
IDataObject,
|
IDataObject,
|
||||||
INodeExecutionData,
|
|
||||||
INodeTypeDescription,
|
|
||||||
INodeType,
|
|
||||||
ILoadOptionsFunctions,
|
ILoadOptionsFunctions,
|
||||||
|
INodeExecutionData,
|
||||||
INodePropertyOptions,
|
INodePropertyOptions,
|
||||||
|
INodeType,
|
||||||
|
INodeTypeDescription,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -18,13 +18,13 @@ import {
|
||||||
} from './GenericFunctions';
|
} from './GenericFunctions';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
channelOperations,
|
|
||||||
channelFields,
|
channelFields,
|
||||||
|
channelOperations,
|
||||||
} from './ChannelDescription';
|
} from './ChannelDescription';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
playlistOperations,
|
|
||||||
playlistFields,
|
playlistFields,
|
||||||
|
playlistOperations,
|
||||||
} from './PlaylistDescription';
|
} from './PlaylistDescription';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -33,13 +33,13 @@ import {
|
||||||
} from './PlaylistItemDescription';
|
} from './PlaylistItemDescription';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
videoOperations,
|
|
||||||
videoFields,
|
videoFields,
|
||||||
|
videoOperations,
|
||||||
} from './VideoDescription';
|
} from './VideoDescription';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
videoCategoryOperations,
|
|
||||||
videoCategoryFields,
|
videoCategoryFields,
|
||||||
|
videoCategoryOperations,
|
||||||
} from './VideoCategoryDescription';
|
} from './VideoCategoryDescription';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -48,7 +48,7 @@ import {
|
||||||
|
|
||||||
export class YouTube implements INodeType {
|
export class YouTube implements INodeType {
|
||||||
description: INodeTypeDescription = {
|
description: INodeTypeDescription = {
|
||||||
displayName: 'Youtube',
|
displayName: 'YouTube',
|
||||||
name: 'youTube',
|
name: 'youTube',
|
||||||
icon: 'file:youTube.png',
|
icon: 'file:youTube.png',
|
||||||
group: ['input'],
|
group: ['input'],
|
||||||
|
@ -379,13 +379,13 @@ export class YouTube implements INodeType {
|
||||||
if (imageSettingsValues?.image) {
|
if (imageSettingsValues?.image) {
|
||||||
const imageSettingsOptions = imageSettings.image as IDataObject;
|
const imageSettingsOptions = imageSettings.image as IDataObject;
|
||||||
if (imageSettingsOptions.bannerExternalUrl) {
|
if (imageSettingsOptions.bannerExternalUrl) {
|
||||||
imageSettings.bannerExternalUrl = imageSettingsOptions.bannerExternalUrl as string
|
imageSettings.bannerExternalUrl = imageSettingsOptions.bannerExternalUrl as string;
|
||||||
}
|
}
|
||||||
if (imageSettingsOptions.trackingImageUrl) {
|
if (imageSettingsOptions.trackingImageUrl) {
|
||||||
imageSettings.trackingImageUrl = imageSettingsOptions.trackingImageUrl as string
|
imageSettings.trackingImageUrl = imageSettingsOptions.trackingImageUrl as string;
|
||||||
}
|
}
|
||||||
if (imageSettingsOptions.watchIconImageUrl) {
|
if (imageSettingsOptions.watchIconImageUrl) {
|
||||||
imageSettings.watchIconImageUrl = imageSettingsOptions.watchIconImageUrl as string
|
imageSettings.watchIconImageUrl = imageSettingsOptions.watchIconImageUrl as string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -434,11 +434,11 @@ export class YouTube implements INodeType {
|
||||||
json: false,
|
json: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
let response = await googleApiRequest.call(this, 'POST', '/upload/youtube/v3/channelBanners/insert', body, qs, undefined, requestOptions);
|
const response = await googleApiRequest.call(this, 'POST', '/upload/youtube/v3/channelBanners/insert', body, qs, undefined, requestOptions);
|
||||||
|
|
||||||
const { url } = JSON.parse(response);
|
const { url } = JSON.parse(response);
|
||||||
|
|
||||||
qs.part = 'brandingSettings'
|
qs.part = 'brandingSettings';
|
||||||
|
|
||||||
responseData = await googleApiRequest.call(
|
responseData = await googleApiRequest.call(
|
||||||
this,
|
this,
|
||||||
|
@ -744,7 +744,7 @@ export class YouTube implements INodeType {
|
||||||
playlistId,
|
playlistId,
|
||||||
resourceId: {
|
resourceId: {
|
||||||
kind: 'youtube#video',
|
kind: 'youtube#video',
|
||||||
videoId: videoId,
|
videoId,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
contentDetails: {
|
contentDetails: {
|
||||||
|
@ -921,7 +921,7 @@ export class YouTube implements INodeType {
|
||||||
json: false,
|
json: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
let response = await googleApiRequest.call(this, 'POST', '/upload/youtube/v3/videos', body, qs, undefined, requestOptions);
|
const response = await googleApiRequest.call(this, 'POST', '/upload/youtube/v3/videos', body, qs, undefined, requestOptions);
|
||||||
|
|
||||||
const { id } = JSON.parse(response);
|
const { id } = JSON.parse(response);
|
||||||
|
|
||||||
|
@ -937,7 +937,7 @@ export class YouTube implements INodeType {
|
||||||
},
|
},
|
||||||
recordingDetails: {
|
recordingDetails: {
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
|
|
||||||
if (options.description) {
|
if (options.description) {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
|
@ -1021,7 +1021,7 @@ export class YouTube implements INodeType {
|
||||||
},
|
},
|
||||||
recordingDetails: {
|
recordingDetails: {
|
||||||
},
|
},
|
||||||
}
|
};
|
||||||
|
|
||||||
if (updateFields.description) {
|
if (updateFields.description) {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
|
|
Loading…
Reference in a new issue