2023-09-27 17:00:40 +00:00
|
|
|
# `ProviderControls.runAll`
|
|
|
|
|
2023-09-27 18:51:54 +00:00
|
|
|
Run all providers one by one in order of their built-in ranking.
|
2023-09-27 17:00:40 +00:00
|
|
|
You can attach events if you need to know what is going on while its processing.
|
|
|
|
|
|
|
|
## Example
|
|
|
|
|
|
|
|
```ts
|
|
|
|
// media from TMDB
|
|
|
|
const media = {
|
|
|
|
type: 'movie',
|
|
|
|
title: "Hamilton",
|
|
|
|
releaseYear: 2020,
|
|
|
|
tmdbId: "556574"
|
|
|
|
}
|
|
|
|
|
|
|
|
// scrape a stream
|
|
|
|
const stream = await providers.runAll({
|
|
|
|
media: media,
|
|
|
|
})
|
|
|
|
|
|
|
|
// scrape a stream, but prioritize flixhq above all
|
|
|
|
// (other scrapers are stil ran if flixhq fails, it just has priority)
|
|
|
|
const flixhqStream = await providers.runAll({
|
|
|
|
media: media,
|
|
|
|
sourceOrder: ['flixhq']
|
|
|
|
})
|
|
|
|
```
|
|
|
|
|
|
|
|
## Type
|
|
|
|
|
|
|
|
```ts
|
|
|
|
function runAll(runnerOps: RunnerOptions): Promise<RunOutput | null>;
|
|
|
|
|
|
|
|
interface RunnerOptions {
|
|
|
|
// overwrite the order of sources to run. list of ids
|
|
|
|
// any omitted ids are in added to the end in order of rank (highest first)
|
|
|
|
sourceOrder?: string[];
|
|
|
|
|
|
|
|
// overwrite the order of embeds to run. list of ids
|
|
|
|
// any omitted ids are in added to the end in order of rank (highest first)
|
|
|
|
embedOrder?: string[];
|
|
|
|
|
|
|
|
// object of event functions
|
|
|
|
events?: FullScraperEvents;
|
|
|
|
|
|
|
|
// the media you want to see sources from
|
|
|
|
media: ScrapeMedia;
|
|
|
|
}
|
|
|
|
|
|
|
|
type RunOutput = {
|
|
|
|
// source scraper id
|
|
|
|
sourceId: string;
|
|
|
|
|
|
|
|
// if from an embed, this is the embed scraper id
|
|
|
|
embedId?: string;
|
|
|
|
|
|
|
|
// the outputed stream
|
|
|
|
stream: Stream;
|
|
|
|
};
|
|
|
|
```
|