extension(animez): Added stream extraction

This commit is contained in:
Swakshan
2025-03-17 17:37:19 +05:30
parent fb22d4b3e1
commit 060e7faba5

View File

@@ -6,7 +6,7 @@ const mangayomiSources = [{
"iconUrl": "https://www.google.com/s2/favicons?sz=256&domain=https://animez.org/", "iconUrl": "https://www.google.com/s2/favicons?sz=256&domain=https://animez.org/",
"typeSource": "multi", "typeSource": "multi",
"itemType": 1, "itemType": 1,
"version": "0.0.2", "version": "1.0.0",
"pkgPath": "anime/src/en/animez.js" "pkgPath": "anime/src/en/animez.js"
}]; }];
@@ -171,7 +171,7 @@ class DefaultExtension extends MProvider {
var lastEntry = chapters[pos] var lastEntry = chapters[pos]
if(lastEntry.name == epData.name){ // if last entries name is same then append url and scanlator to last entry if(lastEntry.name == epData.name){ // if last entries name is same then append url and scanlator to last entry
chapters.pop() // remove the last entry chapters.pop() // remove the last entry
epData.url = `${epData.url} || ${lastEntry.url}` epData.url = `${epData.url}||${lastEntry.url}`
epData.scanlator = `${lastEntry.scanlator}, ${epData.scanlator}` epData.scanlator = `${lastEntry.scanlator}, ${epData.scanlator}`
chapLen = pos; // since the last entry is removed the chapLen will decrease chapLen = pos; // since the last entry is removed the chapLen will decrease
} }
@@ -190,25 +190,49 @@ class DefaultExtension extends MProvider {
genre, genre,
}; };
} }
// For novel html content
async getHtmlContent(url) { // Sorts streams based on user preference.
throw new Error("getHtmlContent not implemented"); sortStreams(streams) {
} var sortedStreams = [];
// Clean html up for reader
async cleanHtmlContent(html) { var copyStreams = streams.slice()
throw new Error("cleanHtmlContent not implemented"); var pref = this.getPreference("animez_pref_stream_audio");
for (var stream of streams) {
if (stream.quality.indexOf(pref) > -1) {
sortedStreams.push(stream);
var index = copyStreams.indexOf(stream);
if (index > -1) {
copyStreams.splice(index, 1);
}
break;
}
}
return [...sortedStreams, ...copyStreams]
} }
// For anime episode video list // For anime episode video list
async getVideoList(url) { async getVideoList(url) {
throw new Error("getVideoList not implemented"); var linkSlugs = url.split("||")
} var streams = [];
// For manga chapter pages for(var slug of linkSlugs){
async getPageList(url) { var body = await this.request(slug)
throw new Error("getPageList not implemented"); var iframeSrc = body.selectFirst("iframe").getSrc
} var streamLink = iframeSrc.replace("/embed/","/anime/")
getFilterList() { var audio = slug.indexOf("dub-") > -1 ? "Dub" : "Sub"
throw new Error("getFilterList not implemented");
streams.push({
url: streamLink,
originalUrl: streamLink,
quality: audio,
})
}
return sortStreams(streams);
} }
getSourcePreferences() { getSourcePreferences() {
return [{ return [{
key: 'animez_pref_popular_section', key: 'animez_pref_popular_section',
@@ -228,6 +252,15 @@ class DefaultExtension extends MProvider {
entries: ["Latest update", "Hot", "New releases", "Top all", "Top month", "Top week", "Top day", "Top follow", "Top comments", "Number of episodes"], entries: ["Latest update", "Hot", "New releases", "Top all", "Top month", "Top week", "Top day", "Top follow", "Top comments", "Number of episodes"],
entryValues: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"] entryValues: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"]
} }
}, {
key: 'animez_pref_stream_audio',
listPreference: {
title: 'Preferred stream audio',
summary: '',
valueIndex: 0,
entries: ["Sub","Dub"],
entryValues: ["Sub","Dub"],
}
},] },]
} }
} }