Skip to content

Commit f287f30

Browse files
rafalzawadzkijcortesmalexanderlim
authored
[New Component] Gistly YouTube Transcript API (#14763)
* - add Gistly YouTube Transcript API component * - lint * - add Gistly YouTube Transcript API component * - lint * Update components/gistly/gistly.app.mjs Co-authored-by: Jorge Cortes <[email protected]> * Update components/gistly/package.json Co-authored-by: Jorge Cortes <[email protected]> * Update components/gistly/gistly.app.mjs * - pnpm i * - pnpm i * - fix duplicated methods * - prettier * revert unrelated code style changes * Update package.json --------- Co-authored-by: Jorge Cortes <[email protected]> Co-authored-by: Michael Lim <[email protected]>
1 parent 72196ff commit f287f30

File tree

5 files changed

+133
-8
lines changed

5 files changed

+133
-8
lines changed

components/gistly/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Overview
2+
3+
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.
4+
5+
- Instantly fetch transcripts from a library of billions of YouTube videos
6+
- Extract accurate and time-stamped video transcripts for content analysis
7+
- High performance and high availability API for bulk requests
8+
9+
# API Details
10+
11+
- **Endpoint**: `GET https://api.gist.ly/youtube/transcript`
12+
- **Authorization**: Requires an API key in the Authorization header.
13+
- **Parameters**:
14+
- `url` or `videoId`: Specify the YouTube video.
15+
- `text`: Boolean to return plain text transcript.
16+
- `chunkSize`: Maximum characters per transcript chunk (optional).
17+
18+
For more details, visit the [Gistly API documentation](https://gist.ly/youtube-transcript-api#doc).
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import app from "../../gistly.app.mjs";
2+
3+
export default {
4+
key: "gistly-get-transcript",
5+
name: "Get Transcript",
6+
description:
7+
"Fetches transcript/subtitles from a YouTube video using Gistly API.",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
app,
12+
videoUrl: {
13+
propDefinition: [
14+
app,
15+
"videoUrl",
16+
],
17+
optional: true,
18+
},
19+
videoId: {
20+
propDefinition: [
21+
app,
22+
"videoId",
23+
],
24+
optional: true,
25+
},
26+
text: {
27+
propDefinition: [
28+
app,
29+
"text",
30+
],
31+
},
32+
chunkSize: {
33+
propDefinition: [
34+
app,
35+
"chunkSize",
36+
],
37+
},
38+
},
39+
async run({ $ }) {
40+
const params = {
41+
url: this.videoUrl,
42+
videoId: this.videoId,
43+
text: this.text,
44+
chunkSize: this.chunkSize,
45+
};
46+
47+
const response = await this.app.getTranscript({
48+
$,
49+
params,
50+
});
51+
52+
$.export("$summary", "Successfully fetched the transcript for the video.");
53+
return response;
54+
},
55+
};

components/gistly/gistly.app.mjs

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,56 @@
1+
import { axios } from "@pipedream/platform";
2+
13
export default {
24
type: "app",
35
app: "gistly",
4-
propDefinitions: {},
6+
propDefinitions: {
7+
videoUrl: {
8+
type: "string",
9+
label: "YouTube Video URL",
10+
description: "The URL of the YouTube video to fetch the transcript from",
11+
},
12+
videoId: {
13+
type: "string",
14+
label: "YouTube Video ID",
15+
description: "The ID of the YouTube video to fetch the transcript from",
16+
},
17+
text: {
18+
type: "boolean",
19+
label: "Plain Text",
20+
description: "Return plain text transcript",
21+
default: false,
22+
},
23+
chunkSize: {
24+
type: "integer",
25+
label: "Chunk Size",
26+
description: "Maximum characters per transcript chunk",
27+
optional: true,
28+
},
29+
},
530
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
31+
_apiKey() {
32+
return this.$auth.api_key;
33+
},
34+
_apiUrl() {
35+
return "https://api.gist.ly";
36+
},
37+
_makeRequest({
38+
$ = this, path, ...args
39+
}) {
40+
return axios($, {
41+
url: `${this._apiUrl()}${path}`,
42+
...args,
43+
headers: {
44+
"x-api-key": this._apiKey(),
45+
"Content-Type": "application/json",
46+
},
47+
});
48+
},
49+
getTranscript(args = {}) {
50+
return this._makeRequest({
51+
path: "/youtube/transcript",
52+
...args,
53+
});
954
},
1055
},
11-
};
56+
};

components/gistly/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/gistly",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream Gistly Components",
55
"main": "gistly.app.mjs",
66
"keywords": [
@@ -11,5 +11,8 @@
1111
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
1212
"publishConfig": {
1313
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.0.3"
1417
}
15-
}
18+
}

pnpm-lock.yaml

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)