-
Notifications
You must be signed in to change notification settings - Fork 59
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
Add YouTube video caption tool and related stories/tests #149
Add YouTube video caption tool and related stories/tests #149
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check minor details
constructor(fields) { | ||
super(fields); | ||
this.token = fields.token; | ||
this.name = 'youtube_video_caption'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is better to call the tool: youtube-captions-scraper
this.schema = z.object({ | ||
videoId: z | ||
.string() | ||
.describe('The ID of the YouTube video to extract captions from.'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use the Youtube url instead of the video id.
packages/tools/src/index.js
Outdated
@@ -1,2 +1,3 @@ | |||
export * from './firecrawl/index.js'; | |||
export * from './tavily/index.js'; | |||
export * from './youtube-video-caption/index.js'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is best to call the tool: youtube-captions-scraper
import { HTTPError } from 'ky'; | ||
import { getSubtitles } from 'youtube-captions-scraper'; | ||
|
||
export class YouTubeVideoCaption extends Tool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is best to call the tool: youtube-captions-scraper
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LEt's use for the name of the file tool.stories.jsx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use for the name of the file
LEt's use for the name of the file tool.test.js
Don't forget to add the Tool basic doc to the Readme https://github.com/kaiban-ai/KaibanJS/blob/main/packages/tools/README.md |
Guide: Obtain YouTube API Authorization Token Without Custom CredentialsThis guide will help you get a YouTube API authorization token for testing purposes using Google’s OAuth 2.0 Playground without requiring a Client ID and Client Secret. Step 1: Access OAuth 2.0 Playground
Step 2: Select YouTube API Scopes
Step 3: Authorize the APIs
Step 4: Exchange Authorization Code for Tokens
Step 5: Test API Requests
Limitations
Recommendation for Advanced TestingFor more comprehensive testing, create your own project in the Google Cloud Console and obtain a Client ID and Client Secret to fully unlock the YouTube API features. |
Implement with different approach soon... |
Description
This pull request introduces the YouTube Video Caption Tool to the KaibanJS project. This tool extracts video captions from YouTube videos using the YouTube Data API and
youtube-captions-scraper
.Changes
YouTubeVideoCaption
class inindex.js
.Requirements
YouTube API Token
YouTubeVideoCaption
class.Input Parameters
videoId
: A string representing the ID of the YouTube video from which you want to extract captions.Example Usage
Checklist
YouTubeVideoCaption
class.How to Test
npm install
npm run test
YouTubeVideoCaption
tool works as expected by following the usage instructions in the updatedREADME.md
file.