fix: [MTL Novel]: Update Source URLs (#1200)

- Update source URLs for English, French, Spanish, and Indonesian versions of MTL Novel.
- Add support for Portuguese and Russian versions of MTL Novel.
This commit is contained in:
Justin COLLON
2024-09-26 11:46:43 +02:00
committed by GitHub
parent b4a779a109
commit 8d75b746b9
2 changed files with 36 additions and 8 deletions
+20 -4
View File
@@ -1,7 +1,7 @@
[ [
{ {
"id": "mtlnovel", "id": "mtlnovel",
"sourceSite": "https://www.mtlnovel.com/", "sourceSite": "https://www.mtlnovels.com/",
"sourceName": "MTL Novel", "sourceName": "MTL Novel",
"options": { "options": {
"lang": "English" "lang": "English"
@@ -9,7 +9,7 @@
}, },
{ {
"id": "mtlnovel-fr", "id": "mtlnovel-fr",
"sourceSite": "https://fr.mtlnovel.com/", "sourceSite": "https://fr.mtlnovels.com/",
"sourceName": "MTL Novel (FR)", "sourceName": "MTL Novel (FR)",
"options": { "options": {
"lang": "French" "lang": "French"
@@ -17,7 +17,7 @@
}, },
{ {
"id": "mtlnovel-es", "id": "mtlnovel-es",
"sourceSite": "https://es.mtlnovel.com/", "sourceSite": "https://es.mtlnovels.com/",
"sourceName": "MTL Novel (ES)", "sourceName": "MTL Novel (ES)",
"options": { "options": {
"lang": "Spanish" "lang": "Spanish"
@@ -25,10 +25,26 @@
}, },
{ {
"id": "mtlnovel-id", "id": "mtlnovel-id",
"sourceSite": "https://id.mtlnovel.com/", "sourceSite": "https://id.mtlnovels.com/",
"sourceName": "MTL Novel (ID)", "sourceName": "MTL Novel (ID)",
"options": { "options": {
"lang": "Indonesian" "lang": "Indonesian"
} }
},
{
"id": "mtlnovel-pt",
"sourceSite": "https://pt.mtlnovels.com/",
"sourceName": "MTL Novel (PT)",
"options": {
"lang": "Portuguese"
}
},
{
"id": "mtlnovel-ru",
"sourceSite": "https://ru.mtlnovels.com/",
"sourceName": "MTL Novel (RU)",
"options": {
"lang": "Russian"
}
} }
] ]
+16 -4
View File
@@ -32,8 +32,8 @@ class MTLNovelPlugin implements Plugin.PluginBase {
this.name = metadata.sourceName; this.name = metadata.sourceName;
this.icon = 'multisrc/mtlnovel/mtlnovel/icon.png'; this.icon = 'multisrc/mtlnovel/mtlnovel/icon.png';
this.site = metadata.sourceSite; this.site = metadata.sourceSite;
this.mainUrl = 'https://www.mtlnovel.com/'; this.mainUrl = 'https://www.mtlnovels.com/';
this.version = '1.1.1'; this.version = '1.1.2';
this.options = metadata.options ?? ({} as MTLNovelOptions); this.options = metadata.options ?? ({} as MTLNovelOptions);
this.filters = metadata.filters satisfies Filters; this.filters = metadata.filters satisfies Filters;
} }
@@ -42,7 +42,7 @@ class MTLNovelPlugin implements Plugin.PluginBase {
url: string, url: string,
headers: Headers = new Headers(), headers: Headers = new Headers(),
): Promise<Response> { ): Promise<Response> {
headers.append('Alt-Used', 'www.mtlnovel.com'); headers.append('Alt-Used', 'www.mtlnovels.com');
const r = await fetchApi(url, { headers }); const r = await fetchApi(url, { headers });
if (!r.ok) if (!r.ok)
throw new Error( throw new Error(
@@ -124,17 +124,23 @@ class MTLNovelPlugin implements Plugin.PluginBase {
case 'Mots Clés': case 'Mots Clés':
case 'Género': case 'Género':
case 'Label': case 'Label':
case 'Gênero':
case 'Tag':
case 'Теги':
if (novel.genres) novel.genres += ', ' + infoValue; if (novel.genres) novel.genres += ', ' + infoValue;
else novel.genres = infoValue; else novel.genres = infoValue;
break; break;
case 'Author': case 'Author':
case 'Auteur': case 'Auteur':
case 'Autor(a)': case 'Autor(a)':
case 'Autor':
case 'Автор':
novel.author = infoValue; novel.author = infoValue;
break; break;
case 'Status': case 'Status':
case 'Statut': case 'Statut':
case 'Estado': case 'Estado':
case 'Положение дел':
if (infoValue == 'Hiatus') novel.status = NovelStatus.OnHiatus; if (infoValue == 'Hiatus') novel.status = NovelStatus.OnHiatus;
else novel.status = infoValue; else novel.status = infoValue;
break; break;
@@ -170,6 +176,12 @@ class MTLNovelPlugin implements Plugin.PluginBase {
novel.chapters = await getChapters(); novel.chapters = await getChapters();
if (novel.genres) {
const genresArray = novel.genres.split(', ');
genresArray.pop();
novel.genres = genresArray.join(', ');
}
return novel; return novel;
} }
@@ -219,7 +231,7 @@ class MTLNovelPlugin implements Plugin.PluginBase {
imageRequestInit: Plugin.ImageRequestInit = { imageRequestInit: Plugin.ImageRequestInit = {
headers: { headers: {
'Alt-Used': 'www.mtlnovel.com', 'Alt-Used': 'www.mtlnovels.com',
}, },
}; };
} }