-
Notifications
You must be signed in to change notification settings - Fork 142
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'miru-project:main' into patch-5
- Loading branch information
Showing
5 changed files
with
216 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
// ==MiruExtension== | ||
// @name Invidious | ||
// @version v0.0.1 | ||
// @author OshekharO | ||
// @lang all | ||
// @license MIT | ||
// @icon https://invidious.io/apple-touch-icon.png | ||
// @package invidious.io | ||
// @type bangumi | ||
// @webSite https://invidious.slipfox.xyz/api/v1 | ||
// ==/MiruExtension== | ||
|
||
export default class extends Extension { | ||
async latest() { | ||
const res = await this.request(`/trending`); | ||
|
||
if (!Array.isArray(res)) { | ||
// Handle the case when the response is not an array | ||
return []; | ||
} | ||
|
||
return res.map((item) => ({ | ||
title: item.title || "", | ||
url: item.videoId || "", | ||
cover: item.videoThumbnails?.[0]?.url || "", // Use the first thumbnail's URL if available | ||
})); | ||
} | ||
|
||
async search(kw) { | ||
const res = await this.request(`/search?q=${kw}`); | ||
|
||
return res.map((item) => ({ | ||
title: item.title || "", | ||
url: item.videoId || "", | ||
cover: item.videoThumbnails?.[0]?.url || "", | ||
})); | ||
} | ||
|
||
async detail(url) { | ||
const res = await this.request(`/videos/${url}`); | ||
return { | ||
title: res.title, | ||
cover: res.videoThumbnails?.[0]?.url, | ||
desc: res.description, | ||
episodes: [ | ||
{ | ||
title: "Watch", | ||
urls: [ | ||
{ | ||
name: res.title, | ||
url: res.videoId, | ||
}, | ||
], | ||
}, | ||
], | ||
}; | ||
} | ||
|
||
async watch(url) { | ||
const res = await this.request(`/videos/${url}`); | ||
|
||
const sub = await this.request(`/streams/${url}`, { | ||
headers: { | ||
"Miru-Url": "https://pipedapi.kavin.rocks", | ||
}, | ||
}); | ||
|
||
const subtitles = sub.subtitles.map((item) => ({ | ||
title: item.name, | ||
url: item.url, | ||
language: item.code, | ||
})); | ||
|
||
return { | ||
type: "hls", | ||
url: res.formatStreams?.[2]?.url, | ||
subtitles: subtitles, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
// ==MiruExtension== | ||
// @name ACG.RIP | ||
// @version v0.0.1 | ||
// @author MiaoMint | ||
// @lang zh-cn | ||
// @license MIT | ||
// @icon http://r.photo.store.qq.com/psb?/V12tx9ch2GA3dz/FqLQBHE23P.c*XKPM4RI*6*aL0mdnoww*2zSjghMKn8!/r/dPIAAAAAAAAA | ||
// @package rip.acg | ||
// @type bangumi | ||
// @webSite https://acg.rip | ||
// ==/MiruExtension== | ||
|
||
export default class extends Extension { | ||
async createFilter(filter) {} | ||
|
||
async getFullUrl(url) { | ||
return `https://acg.rip${url}`; | ||
} | ||
|
||
async getItemList(html) { | ||
const trs = await this.querySelectorAll(html, "tbody tr"); | ||
const items = []; | ||
for (const item of trs) { | ||
const html = item.content; | ||
const a = this.querySelector(html, ".title a"); | ||
const title = await a.text; | ||
console.log(a.content); | ||
const url = await this.getAttributeText( | ||
a.content, | ||
"a:nth-child(1)", | ||
"href" | ||
); | ||
items.push({ | ||
title, | ||
url, | ||
}); | ||
} | ||
return items; | ||
} | ||
|
||
async latest(page) { | ||
const res = await this.request(`/1/page/${page}`); | ||
return await this.getItemList(res); | ||
} | ||
|
||
async detail(url) { | ||
const res = await this.request(url); | ||
const title = ( | ||
await this.querySelector(res, ".panel-default .panel-heading").text | ||
).trim(); | ||
const desc = await this.querySelector(res, ".post-content").text; | ||
return { | ||
title, | ||
desc, | ||
episodes: [ | ||
{ | ||
title: "种子", | ||
urls: [ | ||
{ | ||
name: "在线观看", | ||
url: await this.getAttributeText(res, ".panel-body .btn", "href"), | ||
}, | ||
], | ||
}, | ||
], | ||
}; | ||
} | ||
|
||
async search(kw, page, filter) { | ||
const res = await this.request(`/page/${page}?term=${kw}`); | ||
return this.getItemList(res); | ||
} | ||
|
||
async watch(url) { | ||
return { | ||
type: "torrent", | ||
url: await this.getFullUrl(url), | ||
}; | ||
} | ||
} | ||
|