Skip to content
Merged
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
20 changes: 8 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,27 @@ All the stremio official add-ons, in `AddonCollection.load()` format
The `index.js` file is meant to be generated from the output of `AddonCollection.save()`


## Update

To re-generate `index.json` you can do `scripts/gen.js > index.json` ( you also need a locally running Stremio Server using either the [Stremio Desktop](https://www.stremio.com/downloads) app or [Stremio service](https://www.stremio.com/download-service))


## Changing the official add-ons

To change what's contained in this module, you have to change `scripts/gen.js`
To change what's contained in this module, you have to change [`scripts/gen.js`](./scripts/gen.js) for **version 1** and [`official-addons-v2/scripts/build.js`](./official-addons-v2/scripts/build.js) for **version 2**.

Besides changing this module, you have to update all it's dependant packages, most notably:

* stremio-api-workers: this is the **most important one**, since it will affect `addonsofficialcollection.json` and therefore the addonCollection API, and therefore all running apps should respect it
* stremio-api-workers: this is the **most important one**, since it will affect `addonsofficialcollection.json` and therefore the addonCollection API, and therefore all running apps should respect it ([`stremio-official-addons@1`][v1-npm-link] package)

* stremio: the desktop/web app ([`stremio-official-addons@1`](https://www.npmjs.com/package/stremio-official-addons) package)
* stremio: the desktop/web app ([`stremio-official-addons@1` package][v1-npm-link])

* stremio-rn: the react native app
* stremio-rn: the react native app ([`stremio-official-addons@1` package][v1-npm-link])

* stremio-web: the new desktop/web app ([`@stremio/stremio-official-addons@2`](https://www.npmjs.com/package/@stremio/stremio-official-addons) package)
* stremio-web: the new desktop/web app ([`@stremio/stremio-official-addons@2` package][v2-npm-link])

* stremio-api-legacy-shim: this one does not *depend on* this module, and does not include it, but it contains a separate list of official add-ons in `addons/official.js` that is respected by all apps using the legacy endpoints
* stremio-core: the core for most applications including web, android tv, android, etc. ([`stremio-official-addons@2` crate][v2-crates-io-link])

* stremio-api-legacy-shim: this one does not *depend on* this module, and does not include it, but it contains a separate list of official add-ons in `addons/official.js` that is respected by all apps using the legacy endpoints **ARCHIVED**

[v1-npm-link]: https://www.npmjs.com/package/stremio-official-addons
[stremio-official-addons downloads badge]: https://img.shields.io/npm/dm/stremio-official-addons?label=stremio-official-addons%20downloads&link=https%3A%2F%2Fwww.npmjs.com%2Fpackage%2Fstremio-official-addons


[stremio-official-addons version badge]: https://img.shields.io/npm/v/stremio-official-addons?label=stremio-official-addons&link=https%3A%2F%2Fwww.npmjs.com%2Fpackage%2Fstremio-official-addons

[v2-npm-link]: https://www.npmjs.com/package/@stremio/stremio-official-addons
Expand Down
29 changes: 15 additions & 14 deletions index.json
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,6 @@
"newEpisodeNotifications": true
}
},
"transportName": "http",
"transportUrl": "https://v3-cinemeta.strem.io/manifest.json",
"flags": {
"official": true,
Expand Down Expand Up @@ -813,10 +812,10 @@
}
]
},
"transportName": "http",
"transportUrl": "https://v3-channels.strem.io/manifest.json",
"flags": {
"official": true
"official": true,
"protected": false
}
},
{
Expand All @@ -838,10 +837,10 @@
"tt"
]
},
"transportName": "http",
"transportUrl": "https://watchhub.strem.io/manifest.json",
"flags": {
"official": true
"official": true,
"protected": false
}
},
{
Expand Down Expand Up @@ -876,10 +875,10 @@
"tt"
]
},
"transportName": "http",
"transportUrl": "https://caching.stremio.net/publicdomainmovies.now.sh/manifest.json",
"flags": {
"official": true
"official": true,
"protected": false
}
},
{
Expand All @@ -901,10 +900,10 @@
],
"logo": "http://www.strem.io/images/addons/opensubtitles-logo.png"
},
"transportName": "http",
"transportUrl": "https://opensubtitles-v3.strem.io/manifest.json",
"flags": {
"official": true
"official": true,
"protected": false
}
},
{
Expand All @@ -922,12 +921,15 @@
"movie",
"other"
],
"catalogs": []
"catalogs": [],
"behaviorHints": {
"adult": false
}
},
"transportName": "legacy",
"transportUrl": "https://opensubtitles.strem.io/stremio/v1",
"flags": {
"official": true
"official": true,
"protected": false
}
},
{
Expand Down Expand Up @@ -965,11 +967,10 @@
],
"catalogs": []
},
"transportName": "http",
"transportUrl": "http://127.0.0.1:11470/local-addon/manifest.json",
"flags": {
"official": true,
"protected": true
}
}
]
]
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
},
"homepage": "https://github.com/Stremio/stremio-official-addons#readme",
"devDependencies": {
"stremio-addon-client": "^1.5.2"
"stremio-addon-client": "^1.5.2",
"stremio-local-addon": "https://[email protected]/Stremio/stremio-local-addon#79cd88c32aa26270af8b662fa7bd92b657f6e14f"
},
"workspaces": [
".",
Expand Down
46 changes: 27 additions & 19 deletions scripts/gen.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
#!/usr/bin/env node

const client = require('stremio-addon-client')
const client = require('stremio-addon-client');
const AddonClient = require('stremio-addon-client/lib/AddonClient');
const transports = require('stremio-addon-client/lib/transports');
const localAddonManifest = require('stremio-local-addon/lib/manifestNoCatalogs');

const PROTECTED_URLS = [
'https://v3-cinemeta.strem.io/manifest.json',
'http://127.0.0.1:11470/local-addon/manifest.json',
];
const ENDPOINTS = [
"https://v3-cinemeta.strem.io/manifest.json",
"https://v3-channels.strem.io/manifest.json",
Expand All @@ -14,23 +21,24 @@ const ENDPOINTS = [

const col = new client.AddonCollection()

Promise.all(ENDPOINTS.map(url => client.detectFromURL(url)))
.then(function(responses) {
responses.forEach(function(x, i) {
if (!x.addon) return
if (JSON.stringify(x.addon.manifest).length > 8192) throw 'manifest bigger than 8kb - aborting!'
x.addon.flags = isProtected(x, i) ? { official: true, protected: true } : { official: true }
col.add(x.addon)
})
})
.then(function() {
console.log(JSON.stringify(col.save(), null, 4))
})
Promise.all(ENDPOINTS.map((transportUrl) => {
if (transportUrl === 'http://127.0.0.1:11470/local-addon/manifest.json') {
return Promise.resolve({ addon: new AddonClient(localAddonManifest, new transports.http(transportUrl), { official: true, protected: true }), transportUrl });
}

return client.detectFromURL(transportUrl);
}))
.then(function (responses) {
responses.forEach(function (response) {
if (!response.addon) return
let descriptor = response.addon.toDescriptor();

function isProtected(x, i) {
// cinemeta
if (i === 0) return true
if (JSON.stringify(descriptor.manifest).length > 8192) throw 'manifest bigger than 8kb - aborting!'
let isProtected = PROTECTED_URLS.includes(descriptor.transportUrl);

// local
if (x.addon.manifest.id.match('local')) return true
}
col.add(new AddonClient(descriptor.manifest, new transports.http(descriptor.transportUrl), { official: true, protected: isProtected }))
})
})
.then(function () {
console.log(JSON.stringify(col.save(), null, 4))
})