"youtube data api - custom app" upload video help

I am in need of someone to provide a code solution for the “youtube data api - custom app” custom code step in which I would like to upload a video. In an ideal world it would be a matter of replicating/translating what i already have in the standard youtube api step.

I have a trigger from a webflow form which provides an upload url for the video that is to be uploaded. (im storing it somewhere else first)

I would like to use this custom app step as it leverages a youtube api key and client id to overcome quota issues with the standard youtube integration. The custom code option also lets me perform some logic around the upload (which im happy to integrate myself, it’s to skip this step if no video url is provided by the previous step).

My code from my existing step, which does not integrate the oauth/api keys and runs into quota issues is as follows (Note: “youtube data api - custom app” starter code follows after):

import youtubeDataApi from “@pipedream/youtube_data_api”;
import fs from “fs”;
import got from “got”;

export default defineComponent({

key: “youtube_data_api-upload-video”,
name: “Upload Video”,
description: “Post a video to your channel. See the docs for more information”,
version: “0.0.2”,
type: “action”,
props: {
youtubeDataApi,
title: {
propDefinition: [
youtubeDataApi,
“title”,
],
},
description: {
propDefinition: [
youtubeDataApi,
“description”,
],
},
fileUrl: {
propDefinition: [
youtubeDataApi,
“fileUrl”,
],
},
filePath: {
propDefinition: [
youtubeDataApi,
“filePath”,
],
},
privacyStatus: {
propDefinition: [
youtubeDataApi,
“privacyStatus”,
],
},
publishAt: {
propDefinition: [
youtubeDataApi,
“publishAt”,
],
},
tags: {
propDefinition: [
youtubeDataApi,
“tags”,
],
},
notifySubscribers: {
propDefinition: [
youtubeDataApi,
“notifySubscribers”,
],
},
},

async run({ steps, $ }) {

  if(steps.trigger.event.data["video-file-upload"] !== null){
    const {
      fileUrl,
      filePath,
      title,
      description,
      privacyStatus,
      publishAt,
      tags,
      notifySubscribers,
    } = this;
    if (!fileUrl && !filePath) {
      throw new Error("This action requires either File URL or File Path. Please enter one or the other above.");
    }
    const body = fileUrl
      ? await got.stream(fileUrl)
      : fs.createReadStream(filePath);
    const resp = (await this.youtubeDataApi.insertVideo({
      title,
      description,
      privacyStatus,
      publishAt,
      tags,
      notifySubscribers,
      content: body,
    })).data;
    $.export("$summary", `Successfully uploaded a new video, "${title}"`);
    return resp;
  } else {
    return steps.trigger.event
  }

},
})

youtube data api - custom app starter code:

import { axios } from “@pipedream/platform”
export default defineComponent({
props: {
youtube_data_api_custom_app: {
type: “app”,
app: “youtube_data_api_custom_app”,
}
},
async run({steps, $}) {
return await axios($, {
url: https://www.googleapis.com/oauth2/v1/userinfo,
headers: {
Authorization: Bearer ${this.youtube_data_api_custom_app.$auth.oauth_access_token},
},

})

},
})

This topic is considered closed. I have managed to solve the issue.