Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
youtube-captions
Advanced tools
A simple utility to fetch YouTube video captions programmatically. This library retrieves captions in plain text or structured format for specified video IDs.
You can install the package via npm:
npm install youtube-captions
Or using Yarn:
yarn add youtube-captions
Or with pnpm:
pnpm add youtube-captions
You can import the getVideoCaptions
function in your project as follows:
import getVideoCaptions from 'youtube-captions';
// or for CommonJS
const getVideoCaptions = require('youtube-captions');
To fetch captions for a specific video, call the function with the video ID and optional configuration:
const videoId = 'jNQXAC9IVRw';
const captions = await getVideoCaptions(videoId, { lang: 'en' });
console.log(captions);
The getVideoCaptions
function accepts the following optional parameters:
lang
(string): Specify the language of the captions (e.g., 'en' for English).plainText
(boolean): If set to true, the captions will be returned in plain text format.const videoId = 'jNQXAC9IVRw';
const captions = await getVideoCaptions('jNQXAC9IVRw', { lang: 'en', plainText: true });
console.log(captions);
The getVideoCaptions
function may throw errors for various reasons:
try {
await getVideoCaptions('invalid_id');
} catch (error) {
console.error('Error fetching captions:', error.message);
}
This library includes tests using Vitest. To run the tests, execute:
npm test
Contributions are welcome! Please feel free to submit a pull request or open an issue to discuss improvements or bugs.
This project is licensed under the MIT License.
FAQs
Youtube video captions generator
The npm package youtube-captions receives a total of 3 weekly downloads. As such, youtube-captions popularity was classified as not popular.
We found that youtube-captions demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.