Keep source plugins in single scraper process
This commit is contained in:
1 parent
0fc1a7b52a
commit
6d713e0a8c
19 files changed
+202
-467
No files matched your search
@@ -87,8 +87,7 @@ function pageUrls(atHome, chapterUrl, expectedPages) {
|
||||
}));
|
||||
}
|
||||
|
||||
function metadata({ html }) {
|
||||
const manga = JSON.parse(html);
|
||||
function metadata({ data: manga }) {
|
||||
if (!manga || manga.type !== 'manga') throw new Error('MangaDex title was not found');
|
||||
const attributes = manga.attributes || {};
|
||||
const title = localizedTitle(attributes);
|
||||
@@ -101,8 +100,7 @@ function metadata({ html }) {
|
||||
} };
|
||||
}
|
||||
|
||||
function feed({ html }) {
|
||||
const releases = JSON.parse(html);
|
||||
function feed({ data: releases }) {
|
||||
if (!Array.isArray(releases)) throw new Error('Invalid MangaDex feed');
|
||||
return { releases: releases.map(resource => ({
|
||||
id: resource.id,
|
||||
@@ -116,15 +114,15 @@ function feed({ html }) {
|
||||
})) };
|
||||
}
|
||||
|
||||
function catalog({ html }) {
|
||||
const { attributes, releases, specialLabel, externalReleases } = JSON.parse(html);
|
||||
function catalog({ data }) {
|
||||
const { attributes, releases, specialLabel, externalReleases } = data;
|
||||
if (!attributes || !Array.isArray(releases)) throw new Error('Invalid MangaDex catalog input');
|
||||
const chapters = selectChapterReleases(releases, specialLabel);
|
||||
return { chapters, availability: availabilitySummary(attributes, releases, chapters, externalReleases) };
|
||||
}
|
||||
|
||||
function atHome({ html }) {
|
||||
const { response, chapterUrl, expectedPages } = JSON.parse(html);
|
||||
function atHome({ data }) {
|
||||
const { response, chapterUrl, expectedPages } = data;
|
||||
return { pages: pageUrls(response, chapterUrl, expectedPages) };
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user