Skip to content

Commit

Permalink
Merge branch 'miru-project:main' into OshekharO-patch-1-1
Browse files Browse the repository at this point in the history
  • Loading branch information
OshekharO authored Sep 30, 2023
2 parents 9dc0f17 + c4d623d commit 5d75a41
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Miru extensions repository | [Miru App Download](https://github.com/miru-project
| Comrademao | comrademao | v0.0.3 | OshekharO | en | fikushon | [Source Code](https://github.com/miru-project/repo/blob/main/repo/comrademao.js) |
| 7喜影院 | dev.0n0.miru.7xi | v0.0.5 | MiaoMint | zh-cn | bangumi | [Source Code](https://github.com/miru-project/repo/blob/main/repo/dev.0n0.miru.7xi.js) |
| Flixhq | flixhq.to | v0.0.1 | OshekharO | all | bangumi | [Source Code](https://github.com/miru-project/repo/blob/main/repo/flixhq.to.js) |
| GoGoAnime | gogo.anime | v0.0.1 | OshekharO | en | bangumi | [Source Code](https://github.com/miru-project/repo/blob/main/repo/gogo.anime.js) |
| GoGoAnime | gogo.anime | v0.0.2 | OshekharO | en | bangumi | [Source Code](https://github.com/miru-project/repo/blob/main/repo/gogo.anime.js) |
| Invidious | invidious.io | v0.0.1 | OshekharO | all | bangumi | [Source Code](https://github.com/miru-project/repo/blob/main/repo/invidious.io.js) |
| IsekaiScan | isekaiscan.to | v0.0.2 | bethro | en | manga | [Source Code](https://github.com/miru-project/repo/blob/main/repo/isekaiscan.to.js) |
| Kissasian | kissasian.fm | v0.0.1 | OshekharO | en | bangumi | [Source Code](https://github.com/miru-project/repo/blob/main/repo/kissasian.fm.js) |
Expand Down
2 changes: 1 addition & 1 deletion index.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
"package": "gogo.anime",
"type": "bangumi",
"url": "gogo.anime.js",
"version": "v0.0.1",
"version": "v0.0.2",
"webSite": "https://api.consumet.org/anime/gogoanime"
},
{
Expand Down
29 changes: 23 additions & 6 deletions repo/gogo.anime.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==MiruExtension==
// @name GoGoAnime
// @version v0.0.1
// @version v0.0.2
// @author OshekharO
// @lang en
// @license MIT
Expand All @@ -24,9 +24,16 @@ export default class extends Extension {
title: "GoGo API",
key: "gogoApi",
type: "input",
description: "GoGo Api Url",
description: "API URL",
defaultValue: "https://api.consumet.org/anime/gogoanime",
});
this.registerSetting({
title: "Preferred quality",
key: "prefQuality",
type: "input",
description: "Choose between 360p/480p/720p/1080p",
defaultValue: "480p",
});
}

async latest(page) {
Expand Down Expand Up @@ -66,10 +73,20 @@ export default class extends Extension {
}

async watch(url) {
const quality = await this.getSetting("prefQuality");
const res = await this.req(`/watch/${url}?server=gogocdn`);
return {
type: "hls",
url: res.sources.pop().url,
};
const prefQuality = res.sources.find(source => source.quality === quality);

if (prefQuality) {
return {
type: "hls",
url: prefQuality.url,
};
} else {
return {
type: "hls",
url: res.sources.pop().url,
};
}
}
}

0 comments on commit 5d75a41

Please sign in to comment.