Skip to content

Commit 8e7ddba

Browse files
committed
- add Gistly YouTube Transcript API component
1 parent b920895 commit 8e7ddba

File tree

5 files changed

+177
-0
lines changed

5 files changed

+177
-0
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: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import app from "../../gistly.app.mjs";
2+
3+
export default {
4+
key: "gistly-fetch-transcript",
5+
name: "Fetch 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: [app, "videoUrl"],
14+
optional: true,
15+
},
16+
videoId: {
17+
propDefinition: [app, "videoId"],
18+
optional: true,
19+
},
20+
text: {
21+
propDefinition: [app, "text"],
22+
},
23+
chunkSize: {
24+
propDefinition: [app, "chunkSize"],
25+
},
26+
},
27+
async run({ $ }) {
28+
const params = {
29+
url: this.videoUrl,
30+
videoId: this.videoId,
31+
text: this.text,
32+
chunkSize: this.chunkSize,
33+
};
34+
35+
const response = await this.app.fetchTranscript({
36+
$,
37+
params,
38+
});
39+
40+
$.export("$summary", `Successfully fetched the transcript for the video.`);
41+
return response;
42+
},
43+
};
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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: [app, "videoUrl"],
14+
optional: true,
15+
},
16+
videoId: {
17+
propDefinition: [app, "videoId"],
18+
optional: true,
19+
},
20+
text: {
21+
propDefinition: [app, "text"],
22+
},
23+
chunkSize: {
24+
propDefinition: [app, "chunkSize"],
25+
},
26+
},
27+
async run({ $ }) {
28+
const params = {
29+
url: this.videoUrl,
30+
videoId: this.videoId,
31+
text: this.text,
32+
chunkSize: this.chunkSize,
33+
};
34+
35+
const response = await this.app.fetchTranscript({
36+
$,
37+
params,
38+
});
39+
40+
$.export("$summary", `Successfully fetched the transcript for the video.`);
41+
return response;
42+
},
43+
};

components/gistly/gistly.app.mjs

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
import { axios } from "@pipedream/platform";
2+
3+
export default {
4+
type: "app",
5+
app: "gistly",
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+
},
30+
methods: {
31+
_apiKey() {
32+
return this.$auth.api_key;
33+
},
34+
_apiUrl() {
35+
return "https://api.gist.ly";
36+
},
37+
_makeRequest({ $ = this, path, ...args }) {
38+
return axios($, {
39+
url: `${this._apiUrl()}${path}`,
40+
...args,
41+
headers: {
42+
Authorization: `Bearer ${this._apiKey()}`,
43+
"Content-Type": "application/json",
44+
},
45+
});
46+
},
47+
fetchTranscript({ $, params }) {
48+
return this._makeRequest({
49+
$,
50+
path: "/youtube/transcript",
51+
params,
52+
});
53+
},
54+
},
55+
};

components/gistly/package.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"name": "@pipedream/gistly",
3+
"version": "0.1.0",
4+
"description": "Pipedream Gistly Components",
5+
"main": "gistly.app.mjs",
6+
"keywords": [
7+
"pipedream",
8+
"gistly"
9+
],
10+
"homepage": "https://gist.ly/youtube-transcript-api",
11+
"author": "Rafal Zawadzki <[email protected]>",
12+
"publishConfig": {
13+
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^1.5.1"
17+
}
18+
}

0 commit comments

Comments
 (0)