Add first-party MangaPill source and distinct volume releases

This commit is contained in:
Codex committed 2026-10-14 09:05:34 +02:00
1 parent a8df57f165
commit a08e847932
20 files changed
+364 -34

No files matched your search

+1
View File
@@ -5,6 +5,7 @@
const adapters = Object.freeze([
require('../sources/weebcentral'),
require('../sources/mangadex'),
require('../sources/mangapill'),
]);
const { adapterForPeer } = require('../../peering/adapter');
+35
View File
@@ -0,0 +1,35 @@
'use strict';
const { parse } = require('../plugins/registry');
function mangaPillInfo(value) {
let url;
try { url = new URL(String(value)); } catch { return null; }
if (url.protocol !== 'https:' || url.hostname !== 'mangapill.com' || url.username || url.password || url.port) return null;
const match = /^\/manga\/(\d+)\/([a-z0-9-]+)\/?$/i.exec(url.pathname);
if (!match) return null;
return { source: 'mangapill', id: match[1], title: match[2].replace(/-/g, ' '),
url: `https://mangapill.com/manga/${match[1]}/${match[2]}` };
}
async function discoverMangaPillCatalog(seriesUrl, http) {
const html = await (await http.get(seriesUrl, { accept: 'text/html' })).text();
const parsed = parse('mangapill', 'catalog', { html, url: seriesUrl });
const chapters = parsed.chapters.sort((a, b) => Number(a.number) - Number(b.number));
return { ...parsed, chapters,
...(parsed.chapterLinks && !chapters.length ? { availability: { reason: 'unrecognized-labels',
message: `MangaPill lists ${parsed.chapterLinks} chapter links, but their numbering labels are not recognized.` } } : {}),
};
}
async function discoverMangaPillChapter(ref, http) {
const html = await (await http.get(ref.url, { accept: 'text/html' })).text();
const parsed = parse('mangapill', 'pages', { html, url: ref.url });
if (!parsed.pages.length) throw new Error(`No pages found for MangaPill chapter ${ref.number}`);
return { number: ref.number, title: ref.title || '',
source: { name: 'MangaPill', url: ref.url },
pages: parsed.pages.map(url => ({ url, headers: { referer: ref.url } })),
};
}
module.exports = { mangaPillInfo, discoverMangaPillCatalog, discoverMangaPillChapter };
+5 -1
View File
@@ -25,7 +25,9 @@ async function discoverWeebCatalog(seriesUrl, http) {
const parsed = parse('weebcentral', 'catalog', { html: listHtml, url: seriesUrl });
const chapterLinks = parsed.chapterLinks;
const chapters = parsed.chapters.sort((a, b) =>
Number(a.book?.number || 1) - Number(b.book?.number || 1) || Number(a.number) - Number(b.number));
Number(a.book?.number || 1) - Number(b.book?.number || 1)
|| Number(a.releaseKind === 'volume') - Number(b.releaseKind === 'volume')
|| Number(a.number) - Number(b.number));
return { title, chapters, chapterLinks,
...(chapterLinks && !chapters.length ? { availability: { reason: 'unrecognized-labels',
message: `WeebCentral lists ${chapterLinks} chapter links, but their numbering labels are not recognized by the parser.` } } : {}),
@@ -41,6 +43,8 @@ async function discoverWeebChapter(chapter, http) {
if (!pages.length) throw new Error(`No pages found for chapter ${chapter.number}`);
return {
number: chapter.number, title: chapter.title || '',
...(chapter.special ? { special: true, label: chapter.label, sourceId: chapter.id,
sourceNumber: chapter.volume, releaseKind: chapter.releaseKind, volume: chapter.volume } : {}),
...(chapter.book ? { book: chapter.book } : {}),
added,
source: { name: 'WeebCentral', url: chapter.url }, pages,