mirror of
https://github.com/kodjodevf/mangayomi-extensions.git
synced 2026-02-19 13:20:42 +00:00
extension(animegg): extract streams
This commit is contained in:
@@ -6,7 +6,7 @@ const mangayomiSources = [{
|
|||||||
"iconUrl": "https://www.google.com/s2/favicons?sz=256&domain=https://www.animegg.org/",
|
"iconUrl": "https://www.google.com/s2/favicons?sz=256&domain=https://www.animegg.org/",
|
||||||
"typeSource": "single",
|
"typeSource": "single",
|
||||||
"itemType": 1,
|
"itemType": 1,
|
||||||
"version": "0.0.3",
|
"version": "1.0.0",
|
||||||
"pkgPath": "anime/src/en/animegg.js"
|
"pkgPath": "anime/src/en/animegg.js"
|
||||||
}];
|
}];
|
||||||
|
|
||||||
@@ -19,8 +19,8 @@ class DefaultExtension extends MProvider {
|
|||||||
|
|
||||||
getHeaders(url) {
|
getHeaders(url) {
|
||||||
return {
|
return {
|
||||||
Referer: this.getSourcePreferences.baseUrl,
|
"Referer": this.source.baseUrl,
|
||||||
Origin: this.getSourcePreferences.baseUrl
|
"Origin": this.source.baseUrl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,10 +28,13 @@ class DefaultExtension extends MProvider {
|
|||||||
return new SharedPreferences().get(key);
|
return new SharedPreferences().get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
async request(slug) {
|
async requestText(slug) {
|
||||||
var url = `${this.source.baseUrl}${slug}`
|
var url = `${this.source.baseUrl}${slug}`
|
||||||
var res = await this.client.get(url, this.getHeaders());
|
var res = await this.client.get(url, this.getHeaders());
|
||||||
return new Document(res.body);
|
return res.body;
|
||||||
|
}
|
||||||
|
async request(slug) {
|
||||||
|
return new Document(await this.requestText(slug));
|
||||||
}
|
}
|
||||||
|
|
||||||
async fetchPopularnLatest(slug) {
|
async fetchPopularnLatest(slug) {
|
||||||
@@ -169,25 +172,37 @@ class DefaultExtension extends MProvider {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
// For novel html content
|
|
||||||
async getHtmlContent(url) {
|
|
||||||
throw new Error("getHtmlContent not implemented");
|
|
||||||
}
|
|
||||||
// Clean html up for reader
|
|
||||||
async cleanHtmlContent(html) {
|
|
||||||
throw new Error("cleanHtmlContent not implemented");
|
|
||||||
}
|
|
||||||
// For anime episode video list
|
// For anime episode video list
|
||||||
async getVideoList(url) {
|
async getVideoList(url) {
|
||||||
throw new Error("getVideoList not implemented");
|
var body = await this.request(url)
|
||||||
}
|
var iframe = body.selectFirst("iframe")
|
||||||
// For manga chapter pages
|
var src = iframe.attr('src')
|
||||||
async getPageList(url) {
|
|
||||||
throw new Error("getPageList not implemented");
|
body = await this.requestText(src)
|
||||||
}
|
var sKey = "var videoSources = "
|
||||||
getFilterList() {
|
var eKey = "var httpProtocol"
|
||||||
throw new Error("getFilterList not implemented");
|
var start = body.indexOf(sKey) + sKey.length
|
||||||
|
var end = body.indexOf(eKey) - 8
|
||||||
|
var videoSourcesStr = body.substring(start, end)
|
||||||
|
let videoSources = eval("(" + videoSourcesStr + ")");
|
||||||
|
var streams = []
|
||||||
|
var headers = this.getHeaders();
|
||||||
|
videoSources.forEach(videoSource => {
|
||||||
|
var url = this.source.baseUrl +videoSource.file
|
||||||
|
var quality = videoSource.label
|
||||||
|
|
||||||
|
streams.push({
|
||||||
|
url,
|
||||||
|
originalUrl: url,
|
||||||
|
quality,
|
||||||
|
headers
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return streams.reverse();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getSourcePreferences() {
|
getSourcePreferences() {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user