Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ Stremio currently supports Windows, macOS, Linux, Android and iOS.
**Important: We strongly recommend deploying addons to the [BeamUp](./docs/deploying/beamup.md) servers**


## TypeScript Support

The Stremio Addon SDK includes built-in TypeScript types. You no longer need to install the community package `@types/stremio-addon-sdk` for type definitions as of Stremio Addon SDK version `>1.6.10`.


## Quick Example

This arbitrary example creates an addon that provides a stream for Big Buck Bunny and outputs a HTTP address where you can access it.
Expand Down
24 changes: 24 additions & 0 deletions docs/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- [Using Deep Links in Addons](#using-deep-links-in-addons)
- [Proxying Other Addons](#proxying-other-addons)
- [Crawler (Scraping) Addons](#crawler--scraping-addons)
- [Custom TypeScript Types](#custom-typescript-types)


## Understanding Catalogs
Expand Down Expand Up @@ -427,3 +428,26 @@ Scraping HTML pages presumes downloading the HTML source of a web page in order
A guide showing a simplistic version of doing this is in the readme of the [IMDB Watchlist Addon](https://github.com/jaruba/stremio-imdb-watchlist). The addon uses [needle](https://www.npmjs.com/package/needle) to request the HTML source and [cheerio](https://www.npmjs.com/package/cheerio) to start a jQuery instance in order to simplify getting the desired information.

Cheerio is not the only module that can help with crawling / scraping though, other modules that can aid in this: [jsdom](https://www.npmjs.com/package/jsdom), [xpath](https://www.npmjs.com/package/xpath), etc


## Custom TypeScript Types
### Config

If you accept user data for your addon, you can assign your own custom configuration types to handler functions. For example:

```ts
type Config = {
username: string;
password: string;
};

// ...
builder.defineStreamHandler<Config>(
async ({ id, type, config: { username, password } }) => {
// ^ all arguments above are properly typed
// ...
}
);
```

See [Manifest - User Data](./api/responses/manifest.md#user-data) for more information on how to pass user data to your addon.
Loading