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.
@api.video/media-descriptor
Advanced tools
TypeScript library for managing api.video assets urls, supporting both live and vod, including private content. It enables the generation of manifest URLs, retrieval of metadata, and is usable in both front-end and back-end environments.
This module provides a robust way to handle video media descriptions for both VOD (Video on Demand) and Live streams. It consists of two main components: a factory to create media descriptors and a descriptor class to access media information.
npm install media-descriptor
# or
yarn add media-descriptor
The factory provides two methods to create a MediaDescriptor instance:
fromManifestUrl(url: string, options?: Options): Promise<MediaDescriptor>
Creates a MediaDescriptor from a manifest URL (m3u8).
const descriptor = await MediaDescriptorFactory.fromManifestUrl(
"https://vod.api.video/vod/vi123456789/hls/manifest.m3u8"
);
Supported URL patterns:
domain.com/vod/videoId/hls/manifest.m3u8
domain.com/vod/videoId/token/tokenValue/hls/manifest.m3u8
domain.com/videoId.m3u8
domain.com/private/token/videoId.m3u8
Optional parameters:
options.collectorDomain
: Override the default analytics collector domainfromVideoDescription(videoDescription: VideoDescription): Promise<MediaDescriptor>
Creates a MediaDescriptor from a video description object.
const descriptor = await MediaDescriptorFactory.fromVideoDescription({
mediaId: "vi123456789",
type: "vod",
deliveryDomain: "vod.api.video",
privateToken: "optional-token",
});
The MediaDescriptor class provides access to all video-related information:
title
: Video titlemediaId
: Unique video identifiermediaType
: Either 'vod' or 'live'manifestUrl
: HLS manifest URLmp4Url
: Progressive download URL (VOD only)posterUrl
: Thumbnail URL (VOD only)const domains = descriptor.domains;
// {
// delivery: "vod.api.video",
// collector: "collector.api.video"
// }
// List available chapter languages
const chapters = descriptor.chaptersEntries;
// Get chapter URL for a specific language
const chapterUrl = descriptor.getChapterUrl("en");
// List available summaries
const summaries = descriptor.summaryEntries;
// [{ lang: 'en', generated: false }, { lang: 'fr', generated: true }]
// Get summary content
const summary = await descriptor.getSummary({ lang: "en", generated: false });
// {
// title: string;
// abstract: string;
// takeaways: string[];
// }
The factory methods may throw:
InvalidUrlError
: When the manifest URL format is invalidVideoNotFoundError
: When the video doesn't existMetadataFetchError
: When metadata cannot be retrievedtry {
const descriptor = await MediaDescriptorFactory.fromManifestUrl(manifestUrl);
// Access basic information
console.log(descriptor.title);
console.log(descriptor.manifestUrl);
// Get available chapters
const chapters = descriptor.chaptersEntries;
// Get summary if available
if (descriptor.summaryEntries.length > 0) {
const summary = await descriptor.getSummary(descriptor.summaryEntries[0]);
console.log(summary.abstract);
}
} catch (error) {
if (error instanceof VideoNotFoundError) {
console.error("Video not found");
}
}
Contributions are welcome! Please read the contributing guidelines first.
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
TypeScript library for managing api.video assets urls, supporting both live and vod, including private content. It enables the generation of manifest URLs, retrieval of metadata, and is usable in both front-end and back-end environments.
We found that @api.video/media-descriptor 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.