Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

License

NotificationsYou must be signed in to change notification settings

Stremio/stremio-addon-sdk

Repository files navigation

Stremio

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

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

Important: We strongly recommend deploying addons to theBeamUp 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')constbuilder=newaddonBuilder({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 moviecatalogs:[],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 bunnyconststream={url:'http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_30fps_normal.mp4'}returnPromise.resolve({streams:[stream]})}else{// otherwise return no streamsreturnPromise.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 asaddon.js and run:

npm install stremio-addon-sdknode ./addon.js

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

Please note: addon URLs in Stremio must be loaded with HTTPS (except127.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 from127.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 calledaddon-bootstrap.

You can use it in the following way:

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

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

cd hello-worldnpm installnpm start -- --launch

If you wish to install the addon in the Desktop version of Stremio (which you candownload here), you should usenpm start -- --install

Documentation

All our documentation isright here on GitHub. Take a look at ourexamples list for some high-levelinformation, or dive straight into ourSDK documentation for our code reference docs.

We also have anexample 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 programminglanguage, see theaddon protocol specification for more information.

It is also possible to create an addon without any programming language, see ourstatic addon example basedon 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 ourlist of recommended hosting providers for Node.js or alternatively host it locally withlocaltunnel.

After you've deployed publically, in order to get your addon to show in Stremio (through thepublic Addon collection), you need to usepublishToCentral or publishmanually through the UI.

Examples & tutorials

Check out our ever growing list ofexamples 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 Sleeyaxhere.

Go version

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

Advanced Usage

Read ourguide 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 toreport them here.

Migration from v0.x

To migrate from v0.x, you need to:

  • changenew addonSDK tonew addonBuilder, which you can import viaconst addonBuilder = require('stremio-addon-sdk').addonBuilder
  • changeaddon.run(opts) toserveHTTP(addon.getInterface(), opts), which you can import viaconst serveHTTP = require('stremio-addon-sdk').serveHTTP
  • all handlers have to return aPromise (rather than take acb)

Use Cases Outside Addon SDK

The use of this SDK is not mandatory for creating Stremio Addons. You can use any programming language that supportscreating a HTTP server to make Stremio Addons. Refer to ourprotocol 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 APIAutherntication Token), you can see an example of passing user specific data in the Addon URLhere.This example uses Node.js and Express to get user specific data. (Update: the Addon SDK now supportsuser settings)

built with love and serious coding skills by the Stremio Team


[8]ページ先頭

©2009-2025 Movatter.jp