feat: Convert all app files to JS

This commit is contained in:
Faruk AYDIN
2024-01-05 17:44:21 +01:00
parent b95478b635
commit 43dba351c3
1030 changed files with 5114 additions and 6436 deletions

View File

@@ -0,0 +1,48 @@
import defineTrigger from '../../../../helpers/define-trigger.js';
export default defineTrigger({
name: 'New video in channel',
key: 'newVideoInChannel',
description:
'Triggers when a new video is published to a specific Youtube channel.',
arguments: [
{
label: 'Channel',
key: 'channelId',
type: 'string',
required: true,
description:
'Get the new videos uploaded to this channel. If the URL of the youtube channel looks like this www.youtube.com/channel/UCbxb2fqe9oNgglAoYqsYOtQ then you must use UCbxb2fqe9oNgglAoYqsYOtQ as a value in this field.',
variables: true,
},
],
async run($) {
const channelId = $.step.parameters.channelId;
const params = {
pageToken: undefined,
part: 'snippet',
channelId: channelId,
maxResults: 50,
order: 'date',
type: 'video',
};
do {
const { data } = await $.http.get('/v3/search', { params });
params.pageToken = data.nextPageToken;
if (data?.items?.length) {
for (const item of data.items) {
$.pushTriggerItem({
raw: item,
meta: {
internalId: item.etag,
},
});
}
}
} while (params.pageToken);
},
});