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

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 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/fetch-transcript/fetch-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-fetch-transcript",
name: "Fetch 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.fetchTranscript({
$,
params,
});

$.export("$summary", "Successfully fetched the transcript for the video.");
return response;
},
};
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.fetchTranscript({
$,
params,
});

$.export("$summary", "Successfully fetched the transcript for the video.");
return response;
},
};
56 changes: 56 additions & 0 deletions components/gistly/gistly.app.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "gistly",
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: {
_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",
},
});
},
fetchTranscript(args = {}) {
return this._makeRequest({
path: "/youtube/transcript",
...args,
});
},
},
};
18 changes: 18 additions & 0 deletions components/gistly/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"name": "@pipedream/gistly",
"version": "0.1.0",
"description": "Pipedream Gistly Components",
"main": "gistly.app.mjs",
"keywords": [
"pipedream",
"gistly"
],
"homepage": "https://gist.ly/youtube-transcript-api",
"author": "Rafal Zawadzki <[email protected]>",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.0.3"
}
}
Loading