providers/.docs/content/5.api-reference/3.ProviderControlsrunEmbedS...

45 lines
791 B
Markdown
Raw Normal View History

2023-09-27 17:00:40 +00:00
# `ProviderControls.runEmbedScraper`
2023-12-31 03:35:48 +00:00
Run a specific embed scraper and get its emitted streams.
2023-09-27 17:00:40 +00:00
## Example
```ts
2023-12-29 16:47:49 +00:00
import { SourcererOutput } from '@movie-web/providers';
2023-09-27 17:00:40 +00:00
// scrape a stream from upcloud
let output: EmbedOutput;
try {
output = await providers.runEmbedScraper({
2023-09-27 17:00:40 +00:00
id: 'upcloud',
url: 'https://example.com/123',
})
} catch (err) {
2023-12-29 16:47:49 +00:00
console.log('failed to scrape')
2023-09-27 17:00:40 +00:00
return;
}
// output.stream now has your stream
```
## Type
```ts
function runEmbedScraper(runnerOps: SourceRunnerOptions): Promise<EmbedOutput>;
interface EmbedRunnerOptions {
// object of event functions
events?: IndividualScraperEvents;
2023-12-31 03:35:48 +00:00
// the embed URL
2023-09-27 17:00:40 +00:00
url: string;
2023-12-31 03:35:48 +00:00
// ID of the embed scraper you want to scrape from
2023-09-27 17:00:40 +00:00
id: string;
}
type EmbedOutput = {
stream: Stream;
};
```