mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-10 06:34:05 -08:00
⚡ Minor improvements to YouTube-Node
This commit is contained in:
parent
07973020f9
commit
9e64409ac6
|
@ -1,6 +1,6 @@
|
|||
import {
|
||||
OptionsWithUri,
|
||||
} from 'request';
|
||||
} from 'request';
|
||||
|
||||
import {
|
||||
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[] = [];
|
||||
|
||||
|
|
|
@ -99,6 +99,28 @@ export const playlistItemFields = [
|
|||
},
|
||||
},
|
||||
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',
|
||||
name: 'position',
|
||||
|
@ -109,13 +131,6 @@ export const playlistItemFields = [
|
|||
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',
|
||||
|
@ -123,21 +138,6 @@ export const playlistItemFields = [
|
|||
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`,
|
||||
},
|
||||
],
|
||||
},
|
||||
/* -------------------------------------------------------------------------- */
|
||||
|
|
|
@ -5,11 +5,11 @@ import {
|
|||
|
||||
import {
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
INodeTypeDescription,
|
||||
INodeType,
|
||||
ILoadOptionsFunctions,
|
||||
INodeExecutionData,
|
||||
INodePropertyOptions,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
|
@ -18,13 +18,13 @@ import {
|
|||
} from './GenericFunctions';
|
||||
|
||||
import {
|
||||
channelOperations,
|
||||
channelFields,
|
||||
channelOperations,
|
||||
} from './ChannelDescription';
|
||||
|
||||
import {
|
||||
playlistOperations,
|
||||
playlistFields,
|
||||
playlistOperations,
|
||||
} from './PlaylistDescription';
|
||||
|
||||
import {
|
||||
|
@ -33,13 +33,13 @@ import {
|
|||
} from './PlaylistItemDescription';
|
||||
|
||||
import {
|
||||
videoOperations,
|
||||
videoFields,
|
||||
videoOperations,
|
||||
} from './VideoDescription';
|
||||
|
||||
import {
|
||||
videoCategoryOperations,
|
||||
videoCategoryFields,
|
||||
videoCategoryOperations,
|
||||
} from './VideoCategoryDescription';
|
||||
|
||||
import {
|
||||
|
@ -48,7 +48,7 @@ import {
|
|||
|
||||
export class YouTube implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'Youtube',
|
||||
displayName: 'YouTube',
|
||||
name: 'youTube',
|
||||
icon: 'file:youTube.png',
|
||||
group: ['input'],
|
||||
|
@ -379,13 +379,13 @@ export class YouTube implements INodeType {
|
|||
if (imageSettingsValues?.image) {
|
||||
const imageSettingsOptions = imageSettings.image as IDataObject;
|
||||
if (imageSettingsOptions.bannerExternalUrl) {
|
||||
imageSettings.bannerExternalUrl = imageSettingsOptions.bannerExternalUrl as string
|
||||
imageSettings.bannerExternalUrl = imageSettingsOptions.bannerExternalUrl as string;
|
||||
}
|
||||
if (imageSettingsOptions.trackingImageUrl) {
|
||||
imageSettings.trackingImageUrl = imageSettingsOptions.trackingImageUrl as string
|
||||
imageSettings.trackingImageUrl = imageSettingsOptions.trackingImageUrl as string;
|
||||
}
|
||||
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,
|
||||
};
|
||||
|
||||
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);
|
||||
|
||||
qs.part = 'brandingSettings'
|
||||
qs.part = 'brandingSettings';
|
||||
|
||||
responseData = await googleApiRequest.call(
|
||||
this,
|
||||
|
@ -744,7 +744,7 @@ export class YouTube implements INodeType {
|
|||
playlistId,
|
||||
resourceId: {
|
||||
kind: 'youtube#video',
|
||||
videoId: videoId,
|
||||
videoId,
|
||||
},
|
||||
},
|
||||
contentDetails: {
|
||||
|
@ -921,7 +921,7 @@ export class YouTube implements INodeType {
|
|||
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);
|
||||
|
||||
|
@ -937,7 +937,7 @@ export class YouTube implements INodeType {
|
|||
},
|
||||
recordingDetails: {
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
if (options.description) {
|
||||
//@ts-ignore
|
||||
|
@ -1021,7 +1021,7 @@ export class YouTube implements INodeType {
|
|||
},
|
||||
recordingDetails: {
|
||||
},
|
||||
}
|
||||
};
|
||||
|
||||
if (updateFields.description) {
|
||||
//@ts-ignore
|
||||
|
|
Loading…
Reference in a new issue