mirror of
https://github.com/movie-web/providers.git
synced 2025-09-13 17:53:24 +00:00
running sources/embeds + media input
This commit is contained in:
19
docs/basic.js
Normal file
19
docs/basic.js
Normal file
@@ -0,0 +1,19 @@
|
||||
async function example() {
|
||||
const providers = makeProviders({
|
||||
fetcher: makeStandardFetcher(fetch),
|
||||
});
|
||||
|
||||
const source = await providers.runAll({
|
||||
media: {
|
||||
title: 'Spider-Man: Across the Spider-Verse',
|
||||
releaseYear: 2023,
|
||||
imbdId: 'tt9362722',
|
||||
tmdbId: '569094',
|
||||
type: 'movie',
|
||||
},
|
||||
});
|
||||
|
||||
if (!source) throw new Error("Couldn't find a stream");
|
||||
if (source.stream.type === 'file') return source.stream.qualities['1080']?.url;
|
||||
if (source.stream.type === 'hls') return source.stream.playlist;
|
||||
}
|
Reference in New Issue
Block a user