Add novel.ovh (#756)

* fix

* test

* fix
This commit is contained in:
Rider21
2024-02-07 20:51:25 +03:00
committed by GitHub
parent 1907814d87
commit db921e704f
12 changed files with 582 additions and 18 deletions
+32 -2
View File
@@ -3,6 +3,7 @@ import { FilterTypes, Filters } from "@libs/filterInputs";
import { fetchApi, fetchFile } from "@libs/fetch";
import { NovelStatus } from "@libs/novelStatus";
import { load as parseHTML } from "cheerio";
import dayjs from "dayjs";
class freedlit implements Plugin.PluginBase {
id = "freedlit.space";
@@ -75,8 +76,13 @@ class freedlit implements Plugin.PluginBase {
const url = loadedCheerio(element).attr("href");
if (!name || !url) return;
const releaseTime = loadedCheerio(element).find('span[class="date"]').text();
chapters.push({ name, url, releaseTime, chapterNumber: chapterIndex + 1 });
const releaseDate = loadedCheerio(element).find('span[class="date"]').text();
chapters.push({
name,
url,
releaseTime: this.parseDate(releaseDate),
chapterNumber: chapterIndex + 1
});
});
novel.chapters = chapters;
@@ -111,6 +117,30 @@ class freedlit implements Plugin.PluginBase {
return novels;
}
parseDate = (dateString: string | undefined = "") => {
const months: { [key: string]: number } = {
января: 1,
февраля: 2,
марта: 3,
апреля: 4,
мая: 5,
июня: 6,
июля: 7,
августа: 8,
сентября: 9,
октября: 10,
ноября: 11,
декабря: 12,
};
const [day, month, year] = dateString.split(" ");
if (day && months[month] && year) {
return dayjs(year + "-" + months[month] + "-" + day).format("LL");
}
return dateString || null;
};
fetchImage = fetchFile;
filters = {