Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[New Component] Gistly YouTube Transcript API #14763

Merged
merged 17 commits into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions components/gistly/README.md
Original file line number Diff line number Diff line change
@@ -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

jcortes marked this conversation as resolved.
Show resolved Hide resolved
# 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).

jcortes marked this conversation as resolved.
Show resolved Hide resolved
For more details, visit the [Gistly API documentation](https://gist.ly/youtube-transcript-api#doc).
jcortes marked this conversation as resolved.
Show resolved Hide resolved
55 changes: 55 additions & 0 deletions components/gistly/actions/get-transcript/get-transcript.mjs
Original file line number Diff line number Diff line change
@@ -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;
},
};
55 changes: 50 additions & 5 deletions components/gistly/gistly.app.mjs
Original file line number Diff line number Diff line change
@@ -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",
},
jcortes marked this conversation as resolved.
Show resolved Hide resolved
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,
},
jcortes marked this conversation as resolved.
Show resolved Hide resolved
},
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,
});
},
},
};
};
7 changes: 5 additions & 2 deletions components/gistly/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/gistly",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream Gistly Components",
"main": "gistly.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,8 @@
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.0.3"
}
}
}
6 changes: 5 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading