• Stars
    star
    373
  • Rank 114,576 (Top 3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 6 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🧙 A Node.js SDK for creating and publishing Stremio add-ons

Stremio Addon SDK 🧙

Stremio

The 🧙 Stremio Addon SDK 🧙 was developed by the Stremio Team as a way of vastly simplifying Node.js addon creation for our streaming platform.

Stremio currently supports Windows, macOS, Linux, Android and iOS.

Important: We strongly recommend deploying addons to the BeamUp servers

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.

const { addonBuilder, serveHTTP, publishToCentral }  = require('stremio-addon-sdk')

const builder = new addonBuilder({
    id: 'org.myexampleaddon',
    version: '1.0.0',

    name: 'simple example',

    // Properties that determine when Stremio picks this addon
    // this means your addon will be used for streams of the type movie
    catalogs: [],
    resources: ['stream'],
    types: ['movie'],
    idPrefixes: ['tt']
})

// takes function(args)
builder.defineStreamHandler(function(args) {
    if (args.type === 'movie' && args.id === 'tt1254207') {
        // serve one stream to big buck bunny
        const stream = { url: 'http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_30fps_normal.mp4' }
        return Promise.resolve({ streams: [stream] })
    } else {
        // otherwise return no streams
        return Promise.resolve({ streams: [] })
    }
})

serveHTTP(builder.getInterface(), { port: process.env.PORT || 7000 })
//publishToCentral("https://your-domain/manifest.json") // <- invoke this if you want to publish your addon and it's accessible publically on "your-domain"

Save this as addon.js and run:

npm install stremio-addon-sdk
node ./addon.js

It will output a URL that you can use to install the addon in Stremio

Please note: addon URLs in Stremio must be loaded with HTTPS (except 127.0.0.1) and must support CORS! CORS support is handled automatically by the SDK, but if you're trying to load your addon remotely (not from 127.0.0.1), you need to support HTTPS.

Getting started with a new addon

In order to scaffold a new Stremio addon, we've made a tool called addon-bootstrap.

You can use it in the following way:

npm install -g stremio-addon-sdk # use sudo if on Linux
addon-bootstrap hello-world

You'll be asked about what resources and types you want to support, after which the addon will be created in the hello-world directory, and you'll be able to run it:

cd hello-world
npm install
npm start -- --launch

If you wish to install the addon in the Desktop version of Stremio (which you can download here), you should use npm start -- --install

Documentation

All our documentation is right here on GitHub. Take a look at our examples list for some high-level information, or dive straight into our SDK documentation for our code reference docs.

We also have an example addon that you can use as a guide to help you build your own addon.

We've made two step by step guides: one for this SDK, and one for any programming language, which you can read here.

If you don't wish to use Node.js (and therefore not use this SDK either), you can create addons in any programming language, see the addon protocol specification for more information.

It is also possible to create an addon without any programming language, see our static addon example based on the protocol specification.

SDK Features Include:

Testing

For developers looking for a quick way to test their new addons, you can either:

Deploying

In order for your addon to be used by others, it needs to be deployed online.

You can check our list of recommended hosting providers for Node.js or alternatively host it locally with localtunnel.

After you've deployed publically, in order to get your addon to show in Stremio (through the public Addon collection), you need to use publishToCentral or publish manually through the UI.

Examples & tutorials

Check out our ever growing list of examples and demo addons. This list also includes examples & tutorials on how to develop Stremio addons in PHP, Python, Ruby, C#, Rust, Java and Go. It also includes a list of video tutorials.

Rust version

There is a third-party Rust version of this SDK built on stremio-core developed by Sleeyax here.

Go version

There is a third-party Go version of this SDK developed by doingodswork here.

Advanced Usage

Read our guide for advanced usage to understand the many ways that addons can be used.

Reporting Issues

If you have any issues regarding the Stremio Addon SDK, please feel free to report them here.

Migration from v0.x

To migrate from v0.x, you need to:

  • change new addonSDK to new addonBuilder, which you can import via const addonBuilder = require('stremio-addon-sdk').addonBuilder
  • change addon.run(opts) to serveHTTP(addon.getInterface(), opts), which you can import via const serveHTTP = require('stremio-addon-sdk').serveHTTP
  • all handlers have to return a Promise (rather than take a cb)

Use Cases Outside Addon SDK

The use of this SDK is not mandatory for creating Stremio Addons. You can use any programming language that supports creating a HTTP server to make Stremio Addons. Refer to our protocol specification for details and examples.

One useful scenario of not using the SDK is when you need user specific data for you addon (for example, an API Autherntication Token), you can see an example of passing user specific data in the Addon URL here. This example uses Node.js and Express to get user specific data. (Update: the Addon SDK now supports user settings)

built with love and serious coding skills by the Stremio Team

More Repositories

1

stremio-web

Stremio - Freedom to Stream
JavaScript
1,145
star
2

stremio-core

⚛️ The Stremio Core: types, addon system, UI models, core logic
Rust
943
star
3

stremio-shell

🐚 Qt5-based shell for Stremio; compile this to run the desktop app
C++
551
star
4

stremio-addons

OBSOLETE; GO TO https://github.com/stremio/stremio-addon-sdk
JavaScript
136
star
5

stremio-service

Rust
120
star
6

server-docker

Builds and publishes Docker image for new releases of server.js
Dockerfile
112
star
7

stremio-translations

🌍 Translation strings used in the Stremio app
JavaScript
97
star
8

stremio-features

Post Feature requests in Issues here
77
star
9

stremio-bugs

🐛 Post bug reports in Issues here
52
star
10

addon-helloworld

👋 Hello World add-on for Stremio
JavaScript
29
star
11

stremio-beamup-cli

CLI for deploying to Beam Up servers
JavaScript
16
star
12

enginefs

simple layer to use and manage P2P streaming engines - used in Stremio
JavaScript
13
star
13

addon-helloworld-python

Python
13
star
14

stremio-beamup

🛠️ A platform as a service (PaaS) hosting for Stremio addons: as easy a Heroku, without the restrictions
HCL
12
star
15

stremio-core-web

Bridge between stremio-core and stremio-web
Rust
12
star
16

stremio-local-addon

Add-on for stremio (using v3 protocol) meant to be ran locally which indexes locally found torrent and video files
JavaScript
11
star
17

stremio-official-addons

All the stremio official add-ons, in an array of AddonDescriptors
JavaScript
10
star
18

stremio-api-client

Facilitates the connection between the stremio-api and Stremio, with extras such as user/add-on sync and persistence.
JavaScript
9
star
19

stremio-core-kotlin

Rust
9
star
20

stremio-php-addon-example

PHP Add-on Example for Stremio
PHP
9
star
21

stremio-chromecast-receiver

Chromecast Receiver application for Stremio
JavaScript
9
star
22

stremio-brand

🖌️ Stremio branding materials/assets
8
star
23

stremio-dice

Experiment: a page to show a random movie
JavaScript
7
star
24

vlc-android-sdk

libvlc for android
Dockerfile
7
star
25

stremio-catalog-builder

A website that allows users to personalise their Stremio catalogs.
JavaScript
6
star
26

stremio-addon-client

Client library for using stremio addons (v3 protocol)
JavaScript
5
star
27

stremio-igdb-addon

Stremio Add-on for Video Game Trailers / Gameplays from IGDB.com
JavaScript
5
star
28

addon-helloworld-go

Helloworld addon implemented in Go
Go
5
star
29

stremio-addon-guide

Guides for making Stremio add-ons
JavaScript
4
star
30

stremio-static-addon-example

Static Add-on Example for Stremio
4
star
31

stremio-video

Abstraction layer on top of different media players
JavaScript
4
star
32

stremio-seed-poc

stremio-core + stremio-web CSS + seed
Rust
3
star
33

addon-helloworld-express

Hello World add-on for Stremio made with Express
JavaScript
3
star
34

stremio-art

Community Art for Stremio
3
star
35

stremio-addon-with-key

Example of an addon protected with keys
JavaScript
3
star
36

addon-helloworld-java

Stremio add-on example in java
Java
3
star
37

stremio-local-files

[OBSOLETE] Local stremio addon to scan local video files and provide them to Stremio
JavaScript
3
star
38

addon-helloworld-csharp

C#
2
star
39

addon-helloworld-ruby

Ruby addon example for stremio
Ruby
2
star
40

get-tracks-data

Get video / audio / subtitles tracks from MKV and MP4 files.
TypeScript
1
star
41

stremio-core-validator

Stremio JSON Schema Validator
Rust
1
star
42

local-search

Rust
1
star
43

stremio-colors

Color pallet for all stremio clients
JavaScript
1
star
44

stremio-search-community-addons

HTML
1
star
45

ytdl-core-blob

Webpacked ytdl-core to remove node 10 dependency
JavaScript
1
star
46

stremio-express-static-addon

Stremio Express Add-on Example
JavaScript
1
star
47

stremio-aggregators

Aggregates catalogs and streams from all stremio add-ons passed to it
JavaScript
1
star