diff --git a/components/gistly/README.md b/components/gistly/README.md new file mode 100644 index 0000000000000..f52da71982270 --- /dev/null +++ b/components/gistly/README.md @@ -0,0 +1,18 @@ +# Overview + +Gistly API allows you to fetch transcripts or subtitles from YouTube videos in various formats. It's a powerful tool for integrating video content into your applications, enabling you to process and analyze video transcripts programmatically. + +- Instantly fetch transcripts from a library of billions of YouTube videos +- Extract accurate and time-stamped video transcripts for content analysis +- High performance and high availability API for bulk requests + +# API Details + +- **Endpoint**: `GET https://api.gist.ly/youtube/transcript` +- **Authorization**: Requires an API key in the Authorization header. +- **Parameters**: + - `url` or `videoId`: Specify the YouTube video. + - `text`: Boolean to return plain text transcript. + - `chunkSize`: Maximum characters per transcript chunk (optional). + +For more details, visit the [Gistly API documentation](https://gist.ly/youtube-transcript-api#doc). diff --git a/components/gistly/actions/get-transcript/get-transcript.mjs b/components/gistly/actions/get-transcript/get-transcript.mjs new file mode 100644 index 0000000000000..ca2e4cd94d067 --- /dev/null +++ b/components/gistly/actions/get-transcript/get-transcript.mjs @@ -0,0 +1,55 @@ +import app from "../../gistly.app.mjs"; + +export default { + key: "gistly-get-transcript", + name: "Get Transcript", + description: + "Fetches transcript/subtitles from a YouTube video using Gistly API.", + version: "0.0.1", + type: "action", + props: { + app, + videoUrl: { + propDefinition: [ + app, + "videoUrl", + ], + optional: true, + }, + videoId: { + propDefinition: [ + app, + "videoId", + ], + optional: true, + }, + text: { + propDefinition: [ + app, + "text", + ], + }, + chunkSize: { + propDefinition: [ + app, + "chunkSize", + ], + }, + }, + async run({ $ }) { + const params = { + url: this.videoUrl, + videoId: this.videoId, + text: this.text, + chunkSize: this.chunkSize, + }; + + const response = await this.app.getTranscript({ + $, + params, + }); + + $.export("$summary", "Successfully fetched the transcript for the video."); + return response; + }, +}; diff --git a/components/gistly/gistly.app.mjs b/components/gistly/gistly.app.mjs index ee246326b55ba..3ebbb97510807 100644 --- a/components/gistly/gistly.app.mjs +++ b/components/gistly/gistly.app.mjs @@ -1,11 +1,56 @@ +import { axios } from "@pipedream/platform"; + export default { type: "app", app: "gistly", - propDefinitions: {}, + propDefinitions: { + videoUrl: { + type: "string", + label: "YouTube Video URL", + description: "The URL of the YouTube video to fetch the transcript from", + }, + videoId: { + type: "string", + label: "YouTube Video ID", + description: "The ID of the YouTube video to fetch the transcript from", + }, + text: { + type: "boolean", + label: "Plain Text", + description: "Return plain text transcript", + default: false, + }, + chunkSize: { + type: "integer", + label: "Chunk Size", + description: "Maximum characters per transcript chunk", + optional: true, + }, + }, methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); + _apiKey() { + return this.$auth.api_key; + }, + _apiUrl() { + return "https://api.gist.ly"; + }, + _makeRequest({ + $ = this, path, ...args + }) { + return axios($, { + url: `${this._apiUrl()}${path}`, + ...args, + headers: { + "x-api-key": this._apiKey(), + "Content-Type": "application/json", + }, + }); + }, + getTranscript(args = {}) { + return this._makeRequest({ + path: "/youtube/transcript", + ...args, + }); }, }, -}; \ No newline at end of file +}; diff --git a/components/gistly/package.json b/components/gistly/package.json index 4f3eb34fb0027..e0c0e2574b53b 100644 --- a/components/gistly/package.json +++ b/components/gistly/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/gistly", - "version": "0.0.1", + "version": "0.1.0", "description": "Pipedream Gistly Components", "main": "gistly.app.mjs", "keywords": [ @@ -11,5 +11,8 @@ "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^3.0.3" } -} \ No newline at end of file +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c5439477444c2..3c9f48ccc964b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3956,7 +3956,11 @@ importers: specifier: ^1.5.1 version: 1.6.6 - components/gistly: {} + components/gistly: + dependencies: + '@pipedream/platform': + specifier: ^3.0.3 + version: 3.0.3 components/github: dependencies: