fix Torrentio

This commit is contained in:
kodjomoustapha
2024-12-06 12:11:08 +01:00
parent 59433f2846
commit 29437b4da6
2 changed files with 26 additions and 32 deletions

View File

@@ -6,7 +6,7 @@ const mangayomiSources = [{
"iconUrl": "https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/javascript/icon/all.torrentio.png", "iconUrl": "https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/javascript/icon/all.torrentio.png",
"typeSource": "torrent", "typeSource": "torrent",
"isManga": false, "isManga": false,
"version": "0.0.1", "version": "0.0.15",
"appMinVerReq": "0.3.8", "appMinVerReq": "0.3.8",
"pkgPath": "anime/src/all/torrentio.js" "pkgPath": "anime/src/all/torrentio.js"
}]; }];
@@ -197,29 +197,26 @@ class DefaultExtension extends MProvider {
return anime; return anime;
} }
appendQueryParam(key, values) {
let url = "";
if (values && values.length > 0) {
const filteredValues = Array.from(values).filter(value => value.trim() !== "").join(",");
url += `${key}=${filteredValues}|`;
}
return url;
};
async getVideoList(url) { async getVideoList(url) {
const preferences = new SharedPreferences(); const preferences = new SharedPreferences();
let mainURL = `${this.source.baseUrl}/`; let mainURL = `${this.source.baseUrl}/`;
mainURL += this.appendQueryParam("providers", preferences.get("provider_selection"));
const appendQueryParam = (key, values) => { mainURL += this.appendQueryParam("language", preferences.get("lang_selection"));
if (values && values.size > 0) { mainURL += this.appendQueryParam("qualityfilter", preferences.get("quality_selection"));
const filteredValues = Array.from(values).filter(value => value.trim() !== "").join(","); mainURL += this.appendQueryParam("sort", new Set([preferences.get("sorting_link")]));
mainURL += `${key}=${filteredValues}|`;
}
};
appendQueryParam("providers", preferences.get("provider_selection"));
appendQueryParam("language", preferences.get("lang_selection"));
appendQueryParam("qualityfilter", preferences.get("quality_selection"));
appendQueryParam("sort", new Set([preferences.get("sorting_link")]));
mainURL += url; mainURL += url;
mainURL = mainURL.replace(/\|$/, ""); mainURL = mainURL.replace(/\|$/, "");
const responseEpisodes = await this.client.get(mainURL); const responseEpisodes = await this.client.get(mainURL);
const streamList = JSON.parse(responseEpisodes.body); const streamList = JSON.parse(responseEpisodes.body);
const animeTrackers = ` const animeTrackers = `
http://nyaa.tracker.wf:7777/announce, http://nyaa.tracker.wf:7777/announce,
http://anidex.moe:6969/announce,http://tracker.anirena.com:80/announce, http://anidex.moe:6969/announce,http://tracker.anirena.com:80/announce,

View File

@@ -6,7 +6,7 @@ const mangayomiSources = [{
"iconUrl": "https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/javascript/icon/all.torrentio.png", "iconUrl": "https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/javascript/icon/all.torrentio.png",
"typeSource": "torrent", "typeSource": "torrent",
"isManga": false, "isManga": false,
"version": "0.0.1", "version": "0.0.15",
"appMinVerReq": "0.3.8", "appMinVerReq": "0.3.8",
"pkgPath": "anime/src/all/torrentioanime.js" "pkgPath": "anime/src/all/torrentioanime.js"
}]; }];
@@ -284,29 +284,26 @@ class DefaultExtension extends MProvider {
return anime; return anime;
} }
appendQueryParam(key, values) {
let url = "";
if (values && values.length > 0) {
const filteredValues = Array.from(values).filter(value => value.trim() !== "").join(",");
url += `${key}=${filteredValues}|`;
}
return url;
};
async getVideoList(url) { async getVideoList(url) {
const preferences = new SharedPreferences(); const preferences = new SharedPreferences();
let mainURL = `${this.source.baseUrl}/`; let mainURL = `${this.source.baseUrl}/`;
mainURL += this.appendQueryParam("providers", preferences.get("provider_selection"));
const appendQueryParam = (key, values) => { mainURL += this.appendQueryParam("language", preferences.get("lang_selection"));
if (values && values.size > 0) { mainURL += this.appendQueryParam("qualityfilter", preferences.get("quality_selection"));
const filteredValues = Array.from(values).filter(value => value.trim() !== "").join(","); mainURL += this.appendQueryParam("sort", new Set([preferences.get("sorting_link")]));
mainURL += `${key}=${filteredValues}|`;
}
};
appendQueryParam("providers", preferences.get("provider_selection"));
appendQueryParam("language", preferences.get("lang_selection"));
appendQueryParam("qualityfilter", preferences.get("quality_selection"));
appendQueryParam("sort", new Set([preferences.get("sorting_link")]));
mainURL += url; mainURL += url;
mainURL = mainURL.replace(/\|$/, ""); mainURL = mainURL.replace(/\|$/, "");
const responseEpisodes = await this.client.get(mainURL); const responseEpisodes = await this.client.get(mainURL);
const streamList = JSON.parse(responseEpisodes.body); const streamList = JSON.parse(responseEpisodes.body);
const animeTrackers = ` const animeTrackers = `
http://nyaa.tracker.wf:7777/announce, http://nyaa.tracker.wf:7777/announce,
http://anidex.moe:6969/announce,http://tracker.anirena.com:80/announce, http://anidex.moe:6969/announce,http://tracker.anirena.com:80/announce,