Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

feat(supadata): add AI actions and output schemas (#16044)

Kishan Parmar9fba048ded6d
diff --git a/bun.lock b/bun.lock
index 42da3687229..013ac94afd5 100644
--- a/bun.lock
+++ b/bun.lock
@@ -8791,7 +8791,7 @@
},
"packages/pieces/community/supadata": {
"name": "@activepieces/piece-supadata",
- "version": "0.1.7",
+ "version": "0.2.0",
"dependencies": {
"@activepieces/core-piece-types": "workspace:*",
"@activepieces/core-utils": "workspace:*",
diff --git a/packages/pieces/community/supadata/package.json b/packages/pieces/community/supadata/package.json
index 2bfd1ec6699..8a5997bce78 100644
--- a/packages/pieces/community/supadata/package.json
+++ b/packages/pieces/community/supadata/package.json
@@ -1,6 +1,6 @@
{
"name": "@activepieces/piece-supadata",
- "version": "0.1.7",
+ "version": "0.2.0",
"main": "./dist/src/index.js",
"types": "./dist/src/index.d.ts",
"scripts": {
diff --git a/packages/pieces/community/supadata/src/index.ts b/packages/pieces/community/supadata/src/index.ts
index c1965205914..08a04c2268d 100644
--- a/packages/pieces/community/supadata/src/index.ts
+++ b/packages/pieces/community/supadata/src/index.ts
@@ -1,46 +1,56 @@
-import { createPiece, PieceAuth } from '@activepieces/pieces-framework';
+import { createPiece, PieceCategory } from '@activepieces/pieces-framework';
+import { createCustomApiCallAction } from '@activepieces/pieces-common';
import { getTranscriptAction } from './lib/actions/get-transcript';
-import { PieceCategory } from '@activepieces/pieces-framework';
-import { httpClient, HttpMethod } from '@activepieces/pieces-common';
+import { getTranscriptFromUrlAction } from './lib/actions/get-transcript-from-url';
+import { getTranscriptJobAction } from './lib/actions/get-transcript-job';
+import { getMediaMetadataAction } from './lib/actions/get-media-metadata';
+import { getYoutubeVideoAction } from './lib/actions/get-youtube-video';
+import { getYoutubeChannelAction } from './lib/actions/get-youtube-channel';
+import { listYoutubeChannelVideosAction } from './lib/actions/list-youtube-channel-videos';
+import { getYoutubePlaylistAction } from './lib/actions/get-youtube-playlist';
+import { listYoutubePlaylistVideosAction } from './lib/actions/list-youtube-playlist-videos';
+import { searchYoutubeAction } from './lib/actions/search-youtube';
+import { startVideoExtractionAction } from './lib/actions/start-video-extraction';
+import { getVideoExtractionResultAction } from './lib/actions/get-video-extraction-result';
+import { scrapeWebPageAction } from './lib/actions/scrape-web-page';
+import { mapWebsiteAction } from './lib/actions/map-website';
+import { getAccountAction } from './lib/actions/get-account';
+import { supadataAuth } from './lib/auth';
import { supadataConfig } from './lib/config';
-const markdownDescription = `
-To obtain your free Supadata API Key, sign up at [Supadata](https://supadata.ai) and then copy the key available in the [dashboard](https://dash.supadata.ai).
-`;
-
-export const supadataAuth = PieceAuth.SecretText({
- description: markdownDescription,
- displayName: 'API Key',
- required: true,
- validate: async (auth) => {
- try {
- await httpClient.sendRequest({
- method: HttpMethod.GET,
- url: `${supadataConfig.baseUrl}/health`,
- headers: {
- [supadataConfig.accessTokenHeaderKey]: auth.auth,
- },
- });
- return {
- valid: true,
- };
- } catch (e) {
- return {
- valid: false,
- error: 'Invalid API Key.',
- };
- }
- },
-});
-
export const supadata = createPiece({
displayName: 'Supadata',
auth: supadataAuth,
- minimumSupportedRelease: '0.30.0',
+ minimumSupportedRelease: '0.88.2',
logoUrl: 'https://cdn.activepieces.com/pieces/supadata.svg',
authors: ['rafalzawadzki'],
categories: [PieceCategory.ARTIFICIAL_INTELLIGENCE, PieceCategory.DEVELOPER_TOOLS, PieceCategory.CONTENT_AND_FILES],
description: 'YouTube Transcripts',
- actions: [getTranscriptAction],
+ actions: [
+ getTranscriptAction,
+ getTranscriptFromUrlAction,
+ getTranscriptJobAction,
+ getMediaMetadataAction,
+ getYoutubeVideoAction,
+ getYoutubeChannelAction,
+ listYoutubeChannelVideosAction,
+ getYoutubePlaylistAction,
+ listYoutubePlaylistVideosAction,
+ searchYoutubeAction,
+ startVideoExtractionAction,
+ getVideoExtractionResultAction,
+ scrapeWebPageAction,
+ mapWebsiteAction,
+ getAccountAction,
+ createCustomApiCallAction({
+ auth: supadataAuth,
+ baseUrl: () => supadataConfig.baseUrl,
+ authMapping: async (auth) => ({
+ [supadataConfig.accessTokenHeaderKey]: auth.secret_text,
+ }),
+ }),
+ ],
triggers: [],
-});
\ No newline at end of file
+});
+
+export { supadataAuth };
diff --git a/packages/pieces/community/supadata/src/lib/actions/get-account.ts b/packages/pieces/community/supadata/src/lib/actions/get-account.ts
new file mode 100644
index 00000000000..904baba7259
--- /dev/null
+++ b/packages/pieces/community/supadata/src/lib/actions/get-account.ts
@@ -0,0 +1,27 @@
+import { createAction } from '@activepieces/pieces-framework';
+import { supadataAuth } from '../auth';
+import { supadataClient } from '../common/client';
+import { supadataGetAccountOutputSchema } from '../output-schemas';
+
+export const getAccountAction = createAction({
+ name: 'supadata_get_account',
+ outputSchema: supadataGetAccountOutputSchema,
+ displayName: 'Get Account',
+ description: 'Fetches the organization, plan and credit usage of the API key.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description: 'Returns the organization id, plan and credit usage (used and maximum) of the connected Supadata account. Use to check remaining credits before starting batch, crawl or extraction jobs. Read-only.',
+ idempotent: true,
+ },
+ auth: supadataAuth,
+ props: {
+ },
+ async run(context) {
+ return supadataClient.request({
+ apiKey: context.auth.secret_text,
+ method: supadataClient.GET,
+ path: '/me',
+ });
+ },
+});
diff --git a/packages/pieces/community/supadata/src/lib/actions/get-media-metadata.ts b/packages/pieces/community/supadata/src/lib/actions/get-media-metadata.ts
new file mode 100644
index 00000000000..880d266d47c
--- /dev/null
+++ b/packages/pieces/community/supadata/src/lib/actions/get-media-metadata.ts
@@ -0,0 +1,34 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { supadataAuth } from '../auth';
+import { supadataClient } from '../common/client';
+import { supadataGetMediaMetadataOutputSchema } from '../output-schemas';
+
+export const getMediaMetadataAction = createAction({
+ name: 'supadata_get_media_metadata',
+ outputSchema: supadataGetMediaMetadataOutputSchema,
+ displayName: 'Get Media Metadata',
+ description: 'Fetches metadata of a post or video on YouTube, TikTok, Instagram, X or Facebook.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description: 'Returns unified metadata (title, author, stats, media, tags) for a social media post or video from YouTube, TikTok, Instagram, X (Twitter) or Facebook given its URL. Read-only.',
+ idempotent: true,
+ },
+ auth: supadataAuth,
+ props: {
+ url: Property.ShortText({
+ displayName: 'Media URL',
+ description: 'URL of the post or video.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { url } = context.propsValue;
+ return supadataClient.request({
+ apiKey: context.auth.secret_text,
+ method: supadataClient.GET,
+ path: '/metadata',
+ query: { url },
+ });
+ },
+});
diff --git a/packages/pieces/community/supadata/src/lib/actions/get-transcript-from-url.ts b/packages/pieces/community/supadata/src/lib/actions/get-transcript-from-url.ts
new file mode 100644
index 00000000000..51aa0bd0a0a
--- /dev/null
+++ b/packages/pieces/community/supadata/src/lib/actions/get-transcript-from-url.ts
@@ -0,0 +1,56 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { supadataAuth } from '../auth';
+import { supadataClient } from '../common/client';
+import { getTranscriptOutputSchema } from '../output-schemas';
+
+export const getTranscriptFromUrlAction = createAction({
+ name: 'supadata_get_transcript',
+ outputSchema: getTranscriptOutputSchema,
+ displayName: 'Get Transcript From URL',
+ description: 'Fetches the transcript of a video on YouTube, TikTok, Instagram, X or Facebook, or of a public media file.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description: 'Retrieves the transcript of a video from YouTube, TikTok, Instagram, X (Twitter), Facebook or a public file URL; falls back to AI generation when no native transcript exists. Large videos return a jobId instead of content: pass it to supadata_get_transcript_job. Works for any platform; the existing get_transcript is YouTube-only. Read-only.',
+ idempotent: true,
+ },
+ auth: supadataAuth,
+ props: {
+ url: Property.ShortText({
+ displayName: 'Video URL',
+ description: 'URL of the video or media file.',
+ required: true,
+ }),
+ lang: Property.ShortText({
+ displayName: 'Language',
+ description: 'Preferred transcript language (ISO 639-1 code), e.g. en.',
+ required: false,
+ }),
+ text: Property.Checkbox({
+ displayName: 'Merge Text',
+ description: 'If true, returns the transcript as one text block instead of timestamped chunks.',
+ required: false,
+ defaultValue: true,
+ }),
+ chunkSize: Property.Number({
+ displayName: 'Chunk Size',
+ description: 'Maximum characters per chunk when Merge Text is off.',
+ required: false,
+ }),
+ mode: Property.StaticDropdown({
+ displayName: 'Mode',
+ description: 'native uses existing transcripts only, generate forces AI transcription, auto tries native then AI.',
+ required: false,
+ options: { disabled: false, options: [{ label: 'native', value: 'native' }, { label: 'auto', value: 'auto' }, { label: 'generate', value: 'generate' }] },
+ }),
+ },
+ async run(context) {
+ const { url, lang, text, chunkSize, mode } = context.propsValue;
+ return supadataClient.request({
+ apiKey: context.auth.secret_text,
+ method: supadataClient.GET,
+ path: '/transcript',
+ query: { url, lang, text, chunkSize, mode },
+ });
+ },
+});
diff --git a/packages/pieces/community/supadata/src/lib/actions/get-transcript-job.ts b/packages/pieces/community/supadata/src/lib/actions/get-transcript-job.ts
new file mode 100644
index 00000000000..1600d202afe
--- /dev/null
+++ b/packages/pieces/community/supadata/src/lib/actions/get-transcript-job.ts
@@ -0,0 +1,33 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { supadataAuth } from '../auth';
+import { supadataClient } from '../common/client';
+import { supadataGetTranscriptJobOutputSchema } from '../output-schemas';
+
+export const getTranscriptJobAction = createAction({
+ name: 'supadata_get_transcript_job',
+ displayName: 'Get Transcript Job',
+ description: 'Checks the status and result of an asynchronous transcript job.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description: 'Reads the status of a transcript job started by supadata_get_transcript and returns the content once completed. Call once per check; it does not wait. Read-only.',
+ idempotent: true,
+ },
+ auth: supadataAuth,
+ outputSchema: supadataGetTranscriptJobOutputSchema,
+ props: {
+ jobId: Property.ShortText({
+ displayName: 'Job ID',
+ description: 'The job id returned by supadata_get_transcript.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { jobId } = context.propsValue;
+ return supadataClient.request({
+ apiKey: context.auth.secret_text,
+ method: supadataClient.GET,
+ path: `/transcript/${encodeURIComponent(jobId)}`,
+ });
+ },
+});
diff --git a/packages/pieces/community/supadata/src/lib/actions/get-transcript.ts b/packages/pieces/community/supadata/src/lib/actions/get-transcript.ts
index b5e62086044..a9dcd0f924b 100644
--- a/packages/pieces/community/supadata/src/lib/actions/get-transcript.ts
+++ b/packages/pieces/community/supadata/src/lib/actions/get-transcript.ts
@@ -1,10 +1,11 @@
import { createAction, Property } from '@activepieces/pieces-framework';
-import { HttpMethod, QueryParams, httpClient } from '@activepieces/pieces-common';
-import { supadataAuth } from '../..';
-import { supadataConfig } from '../config';
+import { supadataAuth } from '../auth';
+import { supadataClient } from '../common/client';
+import { getTranscriptOutputSchema } from '../output-schemas';
export const getTranscriptAction = createAction({
name: 'get_transcript',
+ outputSchema: getTranscriptOutputSchema,
classification: 'READ',
displayName: 'Get Transcript',
description: 'Fetches transcript of a YouTube video.',
@@ -31,24 +32,11 @@ export const getTranscriptAction = createAction({
},
async run(context) {
const { url, text, lang } = context.propsValue;
- const qs:QueryParams = {
- url,
- text: text ? 'true' : 'false',
- }
-
- if (lang) {
- qs['lang'] = lang;
- }
-
- const response = await httpClient.sendRequest({
- method: HttpMethod.GET,
- url: `${supadataConfig.baseUrl}/youtube/transcript`,
- headers: {
- [supadataConfig.accessTokenHeaderKey]: context.auth.secret_text,
- },
- queryParams: qs,
+ return supadataClient.request({
+ apiKey: context.auth.secret_text,
+ method: supadataClient.GET,
+ path: '/youtube/transcript',
+ query: { url, text: text ? 'true' : 'false', lang },
});
-
- return response.body;
},
-});
\ No newline at end of file
+});
diff --git a/packages/pieces/community/supadata/src/lib/actions/get-video-extraction-result.ts b/packages/pieces/community/supadata/src/lib/actions/get-video-extraction-result.ts
new file mode 100644
index 00000000000..aa82cf4bf5e
--- /dev/null
+++ b/packages/pieces/community/supadata/src/lib/actions/get-video-extraction-result.ts
@@ -0,0 +1,33 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { supadataAuth } from '../auth';
+import { supadataClient } from '../common/client';
+import { supadataGetVideoExtractionResultOutputSchema } from '../output-schemas';
+
+export const getVideoExtractionResultAction = createAction({
+ name: 'supadata_get_video_extraction_result',
+ outputSchema: supadataGetVideoExtractionResultOutputSchema,
+ displayName: 'Get Video Extraction Result',
+ description: 'Checks the status and result of a video extraction job.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description: 'Reads the status and extracted data of a job started by supadata_start_video_extraction. Call once per check; it does not wait. Read-only.',
+ idempotent: true,
+ },
+ auth: supadataAuth,
+ props: {
+ jobId: Property.ShortText({
+ displayName: 'Job ID',
+ description: 'The job id returned by supadata_start_video_extraction.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { jobId } = context.propsValue;
+ return supadataClient.request({
+ apiKey: context.auth.secret_text,
+ method: supadataClient.GET,
+ path: `/extract/${encodeURIComponent(jobId)}`,
+ });
+ },
+});
diff --git a/packages/pieces/community/supadata/src/lib/actions/get-youtube-channel.ts b/packages/pieces/community/supadata/src/lib/actions/get-youtube-channel.ts
new file mode 100644
index 00000000000..8b5d7398c5b
--- /dev/null
+++ b/packages/pieces/community/supadata/src/lib/actions/get-youtube-channel.ts
@@ -0,0 +1,34 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { supadataAuth } from '../auth';
+import { supadataClient } from '../common/client';
+import { supadataGetYoutubeChannelOutputSchema } from '../output-schemas';
+
+export const getYoutubeChannelAction = createAction({
+ name: 'supadata_get_youtube_channel',
+ outputSchema: supadataGetYoutubeChannelOutputSchema,
+ displayName: 'Get YouTube Channel',
+ description: 'Fetches metadata of a YouTube channel.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description: 'Returns metadata of a YouTube channel (name, handle, description, subscriber, video and view counts) by channel URL, handle or id. Read-only.',
+ idempotent: true,
+ },
+ auth: supadataAuth,
+ props: {
+ id: Property.ShortText({
+ displayName: 'Channel ID, Handle or URL',
+ description: 'YouTube channel URL, handle (e.g. @name) or id.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { id } = context.propsValue;
+ return supadataClient.request({
+ apiKey: context.auth.secret_text,
+ method: supadataClient.GET,
+ path: '/youtube/channel',
+ query: { id },
+ });
+ },
+});
diff --git a/packages/pieces/community/supadata/src/lib/actions/get-youtube-playlist.ts b/packages/pieces/community/supadata/src/lib/actions/get-youtube-playlist.ts
new file mode 100644
index 00000000000..9a71af6652e
--- /dev/null
+++ b/packages/pieces/community/supadata/src/lib/actions/get-youtube-playlist.ts
@@ -0,0 +1,34 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { supadataAuth } from '../auth';
+import { supadataClient } from '../common/client';
+import { supadataGetYoutubePlaylistOutputSchema } from '../output-schemas';
+
+export const getYoutubePlaylistAction = createAction({
+ name: 'supadata_get_youtube_playlist',
+ outputSchema: supadataGetYoutubePlaylistOutputSchema,
+ displayName: 'Get YouTube Playlist',
+ description: 'Fetches metadata of a YouTube playlist.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description: 'Returns metadata of a YouTube playlist (title, description, video count, view count, channel) by playlist URL or id. Read-only.',
+ idempotent: true,
+ },
+ auth: supadataAuth,
+ props: {
+ id: Property.ShortText({
+ displayName: 'Playlist ID or URL',
+ description: 'YouTube playlist URL or id.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { id } = context.propsValue;
+ return supadataClient.request({
+ apiKey: context.auth.secret_text,
+ method: supadataClient.GET,
+ path: '/youtube/playlist',
+ query: { id },
+ });
+ },
+});
diff --git a/packages/pieces/community/supadata/src/lib/actions/get-youtube-video.ts b/packages/pieces/community/supadata/src/lib/actions/get-youtube-video.ts
new file mode 100644
index 00000000000..ce92a3289c7
--- /dev/null
+++ b/packages/pieces/community/supadata/src/lib/actions/get-youtube-video.ts
@@ -0,0 +1,34 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { supadataAuth } from '../auth';
+import { supadataClient } from '../common/client';
+import { supadataGetYoutubeVideoOutputSchema } from '../output-schemas';
+
+export const getYoutubeVideoAction = createAction({
+ name: 'supadata_get_youtube_video',
+ outputSchema: supadataGetYoutubeVideoOutputSchema,
+ displayName: 'Get YouTube Video',
+ description: 'Fetches metadata of a YouTube video.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description: 'Returns metadata of one YouTube video (title, description, duration, channel, view and like counts, transcript languages) by id or URL. Read-only.',
+ idempotent: true,
+ },
+ auth: supadataAuth,
+ props: {
+ id: Property.ShortText({
+ displayName: 'Video ID or URL',
+ description: 'YouTube video id or URL.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { id } = context.propsValue;
+ return supadataClient.request({
+ apiKey: context.auth.secret_text,
+ method: supadataClient.GET,
+ path: '/youtube/video',
+ query: { id },
+ });
+ },
+});
diff --git a/packages/pieces/community/supadata/src/lib/actions/list-youtube-channel-videos.ts b/packages/pieces/community/supadata/src/lib/actions/list-youtube-channel-videos.ts
new file mode 100644
index 00000000000..5c4a28bc813
--- /dev/null
+++ b/packages/pieces/community/supadata/src/lib/actions/list-youtube-channel-videos.ts
@@ -0,0 +1,45 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { supadataAuth } from '../auth';
+import { supadataClient } from '../common/client';
+import { supadataListYoutubeChannelVideosOutputSchema } from '../output-schemas';
+
+export const listYoutubeChannelVideosAction = createAction({
+ name: 'supadata_list_youtube_channel_videos',
+ outputSchema: supadataListYoutubeChannelVideosOutputSchema,
+ displayName: 'List YouTube Channel Videos',
+ description: 'Lists video ids of a YouTube channel.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description: 'Lists the ids of videos, shorts and live streams on a YouTube channel, optionally limited to one type. Returns ids only; pass them to supadata_get_youtube_video for details. Read-only.',
+ idempotent: true,
+ },
+ auth: supadataAuth,
+ props: {
+ id: Property.ShortText({
+ displayName: 'Channel ID, Handle or URL',
+ description: 'YouTube channel URL, handle (e.g. @name) or id.',
+ required: true,
+ }),
+ limit: Property.Number({
+ displayName: 'Limit',
+ description: 'Maximum number of ids to return.',
+ required: false,
+ }),
+ type: Property.StaticDropdown({
+ displayName: 'Type',
+ description: 'Which kind of videos to list.',
+ required: false,
+ options: { disabled: false, options: [{ label: 'all', value: 'all' }, { label: 'video', value: 'video' }, { label: 'short', value: 'short' }, { label: 'live', value: 'live' }] },
+ }),
+ },
+ async run(context) {
+ const { id, limit, type } = context.propsValue;
+ return supadataClient.request({
+ apiKey: context.auth.secret_text,
+ method: supadataClient.GET,
+ path: '/youtube/channel/videos',
+ query: { id, limit, type },
+ });
+ },
+});
diff --git a/packages/pieces/community/supadata/src/lib/actions/list-youtube-playlist-videos.ts b/packages/pieces/community/supadata/src/lib/actions/list-youtube-playlist-videos.ts
new file mode 100644
index 00000000000..3643612404c
--- /dev/null
+++ b/packages/pieces/community/supadata/src/lib/actions/list-youtube-playlist-videos.ts
@@ -0,0 +1,39 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { supadataAuth } from '../auth';
+import { supadataClient } from '../common/client';
+import { supadataListYoutubeChannelVideosOutputSchema } from '../output-schemas';
+
+export const listYoutubePlaylistVideosAction = createAction({
+ name: 'supadata_list_youtube_playlist_videos',
+ outputSchema: supadataListYoutubeChannelVideosOutputSchema,
+ displayName: 'List YouTube Playlist Videos',
+ description: 'Lists video ids of a YouTube playlist.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description: 'Lists the ids of the videos in a YouTube playlist. Returns ids only; pass them to supadata_get_youtube_video for details. Read-only.',
+ idempotent: true,
+ },
+ auth: supadataAuth,
+ props: {
+ id: Property.ShortText({
+ displayName: 'Playlist ID or URL',
+ description: 'YouTube playlist URL or id.',
+ required: true,
+ }),
+ limit: Property.Number({
+ displayName: 'Limit',
+ description: 'Maximum number of ids to return.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const { id, limit } = context.propsValue;
+ return supadataClient.request({
+ apiKey: context.auth.secret_text,
+ method: supadataClient.GET,
+ path: '/youtube/playlist/videos',
+ query: { id, limit },
+ });
+ },
+});
diff --git a/packages/pieces/community/supadata/src/lib/actions/map-website.ts b/packages/pieces/community/supadata/src/lib/actions/map-website.ts
new file mode 100644
index 00000000000..302739a9dc7
--- /dev/null
+++ b/packages/pieces/community/supadata/src/lib/actions/map-website.ts
@@ -0,0 +1,34 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { supadataAuth } from '../auth';
+import { supadataClient } from '../common/client';
+import { supadataMapWebsiteOutputSchema } from '../output-schemas';
+
+export const mapWebsiteAction = createAction({
+ name: 'supadata_map_website',
+ outputSchema: supadataMapWebsiteOutputSchema,
+ displayName: 'Map Website',
+ description: 'Lists the URLs found on a website.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description: 'Scans a whole website and returns the URLs found on it, useful for building a sitemap or choosing pages to scrape. Read-only.',
+ idempotent: true,
+ },
+ auth: supadataAuth,
+ props: {
+ url: Property.ShortText({
+ displayName: 'URL',
+ description: 'Website URL to map.',
+ required: true,
+ }),
+ },
+ async run(context) {
+ const { url } = context.propsValue;
+ return supadataClient.request({
+ apiKey: context.auth.secret_text,
+ method: supadataClient.GET,
+ path: '/web/map',
+ query: { url },
+ });
+ },
+});
diff --git a/packages/pieces/community/supadata/src/lib/actions/scrape-web-page.ts b/packages/pieces/community/supadata/src/lib/actions/scrape-web-page.ts
new file mode 100644
index 00000000000..c0cdffcfd3d
--- /dev/null
+++ b/packages/pieces/community/supadata/src/lib/actions/scrape-web-page.ts
@@ -0,0 +1,44 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { supadataAuth } from '../auth';
+import { supadataClient } from '../common/client';
+import { supadataScrapeWebPageOutputSchema } from '../output-schemas';
+
+export const scrapeWebPageAction = createAction({
+ name: 'supadata_scrape_web_page',
+ outputSchema: supadataScrapeWebPageOutputSchema,
+ displayName: 'Scrape Web Page',
+ description: 'Extracts the content of a web page as Markdown.',
+ audience: 'ai',
+ classification: 'READ',
+ aiMetadata: {
+ description: 'Fetches a web page and returns its content as Markdown with title, description and the links found on it. Use for reading one page; use supadata_start_web_crawl for a whole site. Read-only.',
+ idempotent: true,
+ },
+ auth: supadataAuth,
+ props: {
+ url: Property.ShortText({
+ displayName: 'URL',
+ description: 'URL of the page to scrape.',
+ required: true,
+ }),
+ noLinks: Property.Checkbox({
+ displayName: 'Exclude Links',
+ description: 'If true, links are stripped from the Markdown.',
+ required: false,
+ }),
+ lang: Property.ShortText({
+ displayName: 'Language',
+ description: 'Preferred page language (ISO 639-1 code).',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const { url, noLinks, lang } = context.propsValue;
+ return supadataClient.request({
+ apiKey: context.auth.secret_text,
+ method: supadataClient.GET,
+ path: '/web/scrape',
+ query: { url, noLinks, lang },
+ });
+ },
+});
diff --git a/packages/pieces/community/supadata/src/lib/actions/search-youtube.ts b/packages/pieces/community/supadata/src/lib/actions/search-youtube.ts
new file mode 100644
index 00000000000..ae84091450a
--- /dev/null
+++ b/packages/pieces/community/supadata/src/lib/actions/search-youtube.ts
@@ -0,0 +1,74 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { supadataAuth } from '../auth';
+import { supadataClient } from '../common/client';
+import { supadataSearchYoutubeOutputSchema } from '../output-schemas';
+
+export const searchYoutubeAction = createAction({
+ name: 'supadata_search_youtube',
+ outputSchema: supadataSearchYoutubeOutputSchema,
+ displayName: 'Search YouTube',
+ description: 'Searches YouTube for videos, channels and playlists.',
+ audience: 'ai',
+ classification: 'SEARCH',
+ aiMetadata: {
+ description: 'Searches YouTube for videos, channels, playlists or movies with optional filters. Without Limit it returns one page plus a nextPageToken; pass that token back as Next Page Token to continue (other filters are then ignored). Read-only.',
+ idempotent: true,
+ },
+ auth: supadataAuth,
+ props: {
+ query: Property.ShortText({
+ displayName: 'Query',
+ description: 'Search text.',
+ required: true,
+ }),
+ type: Property.StaticDropdown({
+ displayName: 'Type',
+ description: 'Filter by content type.',
+ required: false,
+ options: { disabled: false, options: [{ label: 'all', value: 'all' }, { label: 'video', value: 'video' }, { label: 'channel', value: 'channel' }, { label: 'playlist', value: 'playlist' }, { label: 'movie', value: 'movie' }] },
+ }),
+ uploadDate: Property.StaticDropdown({
+ displayName: 'Upload Date',
+ description: 'Filter by upload date (videos and movies only).',
+ required: false,
+ options: { disabled: false, options: [{ label: 'all', value: 'all' }, { label: 'hour', value: 'hour' }, { label: 'today', value: 'today' }, { label: 'week', value: 'week' }, { label: 'month', value: 'month' }, { label: 'year', value: 'year' }] },
+ }),
+ duration: Property.StaticDropdown({
+ displayName: 'Duration',
+ description: 'short is under 4 minutes, medium 4-20 minutes, long over 20 minutes (videos and movies only).',
+ required: false,
+ options: { disabled: false, options: [{ label: 'all', value: 'all' }, { label: 'short', value: 'short' }, { label: 'medium', value: 'medium' }, { label: 'long', value: 'long' }] },
+ }),
+ sortBy: Property.StaticDropdown({
+ displayName: 'Sort By',
+ description: 'Sort order of results.',
+ required: false,
+ options: { disabled: false, options: [{ label: 'relevance', value: 'relevance' }, { label: 'rating', value: 'rating' }, { label: 'date', value: 'date' }, { label: 'views', value: 'views' }] },
+ }),
+ features: Property.StaticMultiSelectDropdown({
+ displayName: 'Features',
+ description: 'Special features to filter by (videos and movies only).',
+ required: false,
+ options: { options: [{ label: 'hd', value: 'hd' }, { label: 'subtitles', value: 'subtitles' }, { label: 'creative-commons', value: 'creative-commons' }, { label: '3d', value: '3d' }, { label: 'live', value: 'live' }, { label: '4k', value: '4k' }, { label: '360', value: '360' }, { label: 'location', value: 'location' }, { label: 'hdr', value: 'hdr' }, { label: 'vr180', value: 'vr180' }] },
+ }),
+ limit: Property.Number({
+ displayName: 'Limit',
+ description: 'Maximum number of results; the API paginates automatically up to this many.',
+ required: false,
+ }),
+ nextPageToken: Property.ShortText({
+ displayName: 'Next Page Token',
+ description: 'Token from a previous search to fetch the next page.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const { query, type, uploadDate, duration, sortBy, features, limit, nextPageToken } = context.propsValue;
+ return supadataClient.request({
+ apiKey: context.auth.secret_text,
+ method: supadataClient.GET,
+ path: '/youtube/search',
+ query: { query, type, uploadDate, duration, sortBy, features, limit, nextPageToken },
+ });
+ },
+});
diff --git a/packages/pieces/community/supadata/src/lib/actions/start-video-extraction.ts b/packages/pieces/community/supadata/src/lib/actions/start-video-extraction.ts
new file mode 100644
index 00000000000..207256b1cdb
--- /dev/null
+++ b/packages/pieces/community/supadata/src/lib/actions/start-video-extraction.ts
@@ -0,0 +1,47 @@
+import { createAction, Property } from '@activepieces/pieces-framework';
+import { supadataAuth } from '../auth';
+import { supadataClient } from '../common/client';
+import { supadataStartVideoExtractionOutputSchema } from '../output-schemas';
+
+export const startVideoExtractionAction = createAction({
+ name: 'supadata_start_video_extraction',
+ outputSchema: supadataStartVideoExtractionOutputSchema,
+ displayName: 'Start Video Extraction',
+ description: 'Starts an AI job extracting structured data from a video.',
+ audience: 'ai',
+ classification: 'WRITE',
+ aiMetadata: {
+ description: 'Starts an asynchronous AI job that analyses a video (YouTube, TikTok, Instagram, X, Facebook or a media file URL) and extracts data matching a prompt, a JSON Schema, or both. Provide at least one of Prompt or Schema. Returns a jobId: poll it with supadata_get_video_extraction_result. Not idempotent; uses credits.',
+ idempotent: false,
+ },
+ auth: supadataAuth,
+ props: {
+ url: Property.ShortText({
+ displayName: 'Video URL',
+ description: 'URL of the video or media file.',
+ required: true,
+ }),
+ prompt: Property.ShortText({
+ displayName: 'Prompt',
+ description: 'Describes what to extract.',
+ required: false,
+ }),
+ schema: Property.Json({
+ displayName: 'Schema',
+ description: 'JSON Schema describing the output format.',
+ required: false,
+ }),
+ },
+ async run(context) {
+ const { url, prompt, schema } = context.propsValue;
+ if (!prompt && !schema) {
+ throw new Error('Provide at least one of Prompt or Schema.');
+ }
+ return supadataClient.request({
+ apiKey: context.auth.secret_text,
+ method: supadataClient.POST,
+ path: '/extract',
+ body: { url, prompt, schema },
+ });
+ },
+});
diff --git a/packages/pieces/community/supadata/src/lib/auth.ts b/packages/pieces/community/supadata/src/lib/auth.ts
new file mode 100644
index 00000000000..2ad317b5930
--- /dev/null
+++ b/packages/pieces/community/supadata/src/lib/auth.ts
@@ -0,0 +1,32 @@
+import { PieceAuth } from '@activepieces/pieces-framework';
+import { httpClient, HttpMethod } from '@activepieces/pieces-common';
+import { supadataConfig } from './config';
+
+const markdownDescription = `
+To obtain your free Supadata API Key, sign up at [Supadata](https://supadata.ai) and then copy the key available in the [dashboard](https://dash.supadata.ai).
+`;
+
+export const supadataAuth = PieceAuth.SecretText({
+ description: markdownDescription,
+ displayName: 'API Key',
+ required: true,
+ validate: async (auth) => {
+ try {
+ await httpClient.sendRequest({
+ method: HttpMethod.GET,
+ url: `${supadataConfig.baseUrl}/health`,
+ headers: {
+ [supadataConfig.accessTokenHeaderKey]: auth.auth,
+ },
+ });
+ return {
+ valid: true,
+ };
+ } catch (e) {
+ return {
+ valid: false,
+ error: 'Invalid API Key.',
+ };
+ }
+ },
+});
diff --git a/packages/pieces/community/supadata/src/lib/common/client.ts b/packages/pieces/community/supadata/src/lib/common/client.ts
new file mode 100644
index 00000000000..921224fff10
--- /dev/null
+++ b/packages/pieces/community/supadata/src/lib/common/client.ts
@@ -0,0 +1,62 @@
+import { httpClient, HttpError, HttpMethod } from '@activepieces/pieces-common';
+import { supadataConfig } from '../config';
+
+async function request({ apiKey, method, path, query, body }: RequestParams): Promise<unknown> {
+ const queryString = buildQueryString({ query });
+ try {
+ const response = await httpClient.sendRequest({
+ method,
+ url: `${supadataConfig.baseUrl}${path}${queryString}`,
+ headers: {
+ [supadataConfig.accessTokenHeaderKey]: apiKey,
+ },
+ body,
+ });
+ return response.body;
+ } catch (error) {
+ if (error instanceof HttpError) {
+ throw new Error(`Supadata API error (${error.response.status}): ${extractMessage({ body: error.response.body })}`);
+ }
+ throw error;
+ }
+}
+
+function buildQueryString({ query }: { query?: QueryInput }): string {
+ const params = new URLSearchParams();
+ Object.entries(query ?? {}).forEach(([key, value]) => {
+ if (value === undefined || value === null || value === '') {
+ return;
+ }
+ if (Array.isArray(value)) {
+ value.forEach((item) => params.append(key, item));
+ return;
+ }
+ params.append(key, String(value));
+ });
+ const serialized = params.toString();
+ return serialized ? `?${serialized}` : '';
+}
+
+function extractMessage({ body }: { body: unknown }): string {
+ if (typeof body === 'string') {
+ return body;
+ }
+ if (typeof body === 'object' && body !== null) {
+ const message = 'message' in body ? body.message : undefined;
+ const details = 'details' in body ? body.details : undefined;
+ return [message, details].filter((part): part is string => typeof part === 'string').join(' - ');
+ }
+ return 'Unknown error';
+}
+
+export const supadataClient = { request, GET: HttpMethod.GET, POST: HttpMethod.POST };
+
+type QueryInput = Record<string, string | number | boolean | string[] | undefined | null>;
+
+type RequestParams = {
+ apiKey: string;
+ method: HttpMethod;
+ path: string;
+ query?: QueryInput;
+ body?: Record<string, unknown>;
+};
diff --git a/packages/pieces/community/supadata/src/lib/output-schemas.ts b/packages/pieces/community/supadata/src/lib/output-schemas.ts
new file mode 100644
index 00000000000..fd81c2f0116
--- /dev/null
+++ b/packages/pieces/community/supadata/src/lib/output-schemas.ts
@@ -0,0 +1,202 @@
+import { OutputSchema } from '@activepieces/pieces-framework';
+
+export const supadataGetAccountOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'organizationId', label: 'Organization ID' },
+ { key: 'plan', label: 'Plan' },
+ { key: 'maxCredits', label: 'Max Credits', format: 'number' },
+ { key: 'usedCredits', label: 'Used Credits', format: 'number' },
+ ],
+};
+
+export const supadataGetYoutubeChannelOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'id', label: 'ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'description', label: 'Description' },
+ { key: 'handle', label: 'Handle' },
+ { key: 'thumbnail', label: 'Thumbnail', format: 'image' },
+ { key: 'banner', label: 'Banner', format: 'url' },
+ { key: 'subscriberCount', label: 'Subscriber Count', format: 'number' },
+ { key: 'videoCount', label: 'Video Count', format: 'number' },
+ { key: 'viewCount', label: 'View Count', format: 'number' },
+ ],
+};
+
+export const supadataListYoutubeChannelVideosOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'videoIds', label: 'Video IDs' },
+ { key: 'shortIds', label: 'Short IDs' },
+ { key: 'liveIds', label: 'Live IDs' },
+ ],
+};
+
+export const supadataStartVideoExtractionOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'jobId', label: 'Job ID' },
+ ],
+};
+
+export const supadataGetVideoExtractionResultOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'status', label: 'Status' },
+ { key: 'data', label: 'Extracted Data', dynamicKey: true },
+ ],
+};
+
+export const getTranscriptOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'content', label: 'Content' },
+ { key: 'lang', label: 'Language' },
+ { key: 'availableLangs', label: 'Available Languages' },
+ ],
+};
+
+export const supadataMapWebsiteOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'urls', label: 'URLs' },
+ ],
+};
+
+export const supadataGetMediaMetadataOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'platform', label: 'Platform' },
+ { key: 'type', label: 'Type' },
+ { key: 'id', label: 'ID' },
+ { key: 'url', label: 'URL', format: 'url' },
+ { key: 'title', label: 'Title' },
+ { key: 'description', label: 'Description' },
+ {
+ key: 'author',
+ label: 'Author',
+ children: [
+ { key: 'displayName', label: 'Display Name' },
+ ],
+ },
+ {
+ key: 'stats',
+ label: 'Stats',
+ children: [
+ { key: 'views', label: 'Views', format: 'number' },
+ { key: 'likes', label: 'Likes', format: 'number' },
+ { key: 'comments', label: 'Comments', format: 'number' },
+ { key: 'shares', label: 'Shares', format: 'number' },
+ ],
+ },
+ {
+ key: 'media',
+ label: 'Media',
+ children: [
+ { key: 'type', label: 'Type' },
+ { key: 'duration', label: 'Duration', format: 'number' },
+ { key: 'thumbnailUrl', label: 'Thumbnail URL', format: 'image' },
+ ],
+ },
+ { key: 'tags', label: 'Tags' },
+ { key: 'createdAt', label: 'Created At', format: 'datetime' },
+ {
+ key: 'additionalData',
+ label: 'Additional Data',
+ children: [
+ { key: 'channelId', label: 'Channel ID' },
+ ],
+ },
+ ],
+};
+
+export const supadataGetYoutubePlaylistOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'id', label: 'ID' },
+ { key: 'title', label: 'Title' },
+ { key: 'description', label: 'Description' },
+ { key: 'videoCount', label: 'Video Count', format: 'number' },
+ { key: 'viewCount', label: 'View Count', format: 'number' },
+ { key: 'lastUpdated', label: 'Last Updated', format: 'datetime' },
+ {
+ key: 'channel',
+ label: 'Channel',
+ children: [
+ { key: 'id', label: 'ID' },
+ { key: 'name', label: 'Name' },
+ ],
+ },
+ ],
+};
+
+export const supadataScrapeWebPageOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'url', label: 'URL', format: 'url' },
+ { key: 'content', label: 'Content' },
+ { key: 'name', label: 'Name' },
+ { key: 'description', label: 'Description' },
+ { key: 'ogUrl', label: 'Open Graph URL' },
+ { key: 'countCharacters', label: 'Character Count', format: 'number' },
+ { key: 'urls', label: 'URLs' },
+ ],
+};
+
+export const supadataSearchYoutubeOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'query', label: 'Query' },
+ {
+ key: 'results',
+ label: 'Results',
+ labelKey: 'title',
+ listItems: [
+ { key: 'type', label: 'Type' },
+ { key: 'id', label: 'ID' },
+ { key: 'title', label: 'Title' },
+ { key: 'description', label: 'Description' },
+ { key: 'thumbnail', label: 'Thumbnail', format: 'image' },
+ { key: 'duration', label: 'Duration', format: 'number' },
+ { key: 'viewCount', label: 'View Count', format: 'number' },
+ { key: 'uploadDate', label: 'Upload Date' },
+ {
+ key: 'channel',
+ label: 'Channel',
+ children: [
+ { key: 'id', label: 'ID' },
+ { key: 'name', label: 'Name' },
+ { key: 'thumbnail', label: 'Thumbnail', format: 'image' },
+ ],
+ },
+ ],
+ },
+ { key: 'totalResults', label: 'Total Results', format: 'number' },
+ { key: 'nextPageToken', label: 'Next Page Token' },
+ ],
+};
+
+export const supadataGetYoutubeVideoOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'id', label: 'ID' },
+ { key: 'description', label: 'Description' },
+ { key: 'title', label: 'Title' },
+ {
+ key: 'channel',
+ label: 'Channel',
+ children: [
+ { key: 'id', label: 'ID' },
+ { key: 'name', label: 'Name' },
+ ],
+ },
+ { key: 'tags', label: 'Tags' },
+ { key: 'thumbnail', label: 'Thumbnail', format: 'image' },
+ { key: 'uploadDate', label: 'Upload Date', format: 'datetime' },
+ { key: 'viewCount', label: 'View Count', format: 'number' },
+ { key: 'likeCount', label: 'Like Count', format: 'number' },
+ { key: 'isLive', label: 'Is Live', format: 'boolean' },
+ { key: 'duration', label: 'Duration', format: 'number' },
+ { key: 'transcriptLanguages', label: 'Transcript Languages' },
+ ],
+};
+
+export const supadataGetTranscriptJobOutputSchema: OutputSchema = {
+ fields: [
+ { key: 'status', label: 'Status' },
+ { key: 'content', label: 'Content' },
+ { key: 'lang', label: 'Language' },
+ { key: 'availableLangs', label: 'Available Languages' },
+ { key: 'error', label: 'Error' },
+ ],
+};