diff --git a/src/common/config.js b/src/common/config.js index 1b05e28..43f45ae 100644 --- a/src/common/config.js +++ b/src/common/config.js @@ -1,5 +1,5 @@ const CINEMETA_URL = "https://v3-cinemeta.strem.io"; -const OPENSUBTITLES_URL = "https://opensubtitles.strem.io"; +const OPENSUBTITLES_URL = "https://opensubtitles-v3.strem.io"; const STREMIO_API_URL = "https://api.strem.io"; const STREMIO_STREAMING_SERVER = "http://localhost:11470"; const ADDON_COMMUNITY_LIST = 'https://stremio-addons.netlify.app/'; diff --git a/src/components/player/controls/Subtitles.vue b/src/components/player/controls/Subtitles.vue index 60b1c0d..7ade6c4 100644 --- a/src/components/player/controls/Subtitles.vue +++ b/src/components/player/controls/Subtitles.vue @@ -132,8 +132,15 @@ export default { this.list = urls.map(url => this.list.find(sub => sub.url === url)); }; - StremioService.getSubtitles(this.videoUrl).then(stremioSubtitles => addToList(stremioSubtitles)); - this.installedSubtitles.map(addon => AddonService.getSubtitles([addon], this.meta.type, this.meta.id).then(addonsSubtitles => addToList(addonsSubtitles))); + StremioService.getSubtitles({ + type: this.meta.type, + id: this.meta.id, + url: this.videoUrl, + }).then(stremioSubtitles => addToList(stremioSubtitles)); + + this.installedSubtitles + .map(addon => AddonService.getSubtitles([addon], this.meta.type, this.meta.id) + .then(addonsSubtitles => addToList(addonsSubtitles))); }, filterSubs() { return this.panelLang ? this.list.filter(s => s.lang === this.panelLang.iso) : []; diff --git a/src/services/stremio.service.js b/src/services/stremio.service.js index 5fec856..34771e0 100644 --- a/src/services/stremio.service.js +++ b/src/services/stremio.service.js @@ -52,26 +52,14 @@ const StremioService = { return data; }, - async getSubtitles(streamUrl) { + async getSubtitles({ type, id, url }) { try { - const { hash, size } = await getOpenSubInfo(streamUrl); - - const jsonrpc = JSON.stringify({ - jsonrpc: '2.0', - id: 1, - method: 'subtitles.find', - params: [ - null, - { - query: { - videoHash: hash, - videoSize: size - } - } - ] + const { hash } = await getOpenSubInfo(url); + return queryOpenSubtitles({ + type, + id, + videoHash: hash, }); - - return queryOpenSubtitles(jsonrpc); } catch(_) { return []; } @@ -85,10 +73,10 @@ async function getOpenSubInfo(streamUrl) { return result; } -async function queryOpenSubtitles(jsonrpc) { - const { data } = await axios.get(`${OPENSUBTITLES_URL}/q.json?b=${btoa(jsonrpc)}`); - const { result } = data; - return result.all; +async function queryOpenSubtitles({ type, id, videoHash }) { + const { data } = await axios.get(`${OPENSUBTITLES_URL}/subtitles/${type}/${id}/videoHash=${videoHash}.json`); + const { subtitles } = data; + return subtitles; } export default StremioService; \ No newline at end of file