@@ -3,7 +3,7 @@ import { Filters, FilterTypes } from "@libs/filterInputs";
|
||||
import { Plugin } from "@typings/plugin";
|
||||
import { NovelStatus } from "@libs/novelStatus";
|
||||
import { load as parseHTML } from "cheerio";
|
||||
// import { defaultCover } from "@libs/defaultCover";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
export interface IfreedomMetadata {
|
||||
id: string;
|
||||
@@ -105,8 +105,13 @@ class IfreedomPlugin implements Plugin.PluginBase {
|
||||
const name = loadedCheerio(element).find("a").text();
|
||||
const url = loadedCheerio(element).find("a").attr("href");
|
||||
if (!loadedCheerio(element).find("label.buy-ranobe").length && name && url) {
|
||||
const releaseTime = loadedCheerio(element).find("div.li-col2-ranobe").text().trim();
|
||||
chapters.push({ name, url, releaseTime, chapterNumber: totalChapters - chapterIndex });
|
||||
const releaseDate = loadedCheerio(element).find("div.li-col2-ranobe").text().trim();
|
||||
chapters.push({
|
||||
name,
|
||||
url,
|
||||
releaseTime: this.parseDate(releaseDate),
|
||||
chapterNumber: totalChapters - chapterIndex
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -156,5 +161,36 @@ class IfreedomPlugin 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,
|
||||
};
|
||||
|
||||
if (dateString.includes(".")) {
|
||||
const [day, month, year] = dateString.split(".");
|
||||
if (day && month && year) {
|
||||
return dayjs(year + "-" + month + "-" + day).format("LL");
|
||||
}
|
||||
} else if (dateString.includes(" ")) {
|
||||
const [day, month] = dateString.split(" ");
|
||||
if (day && months[month]) {
|
||||
const year = new Date().getFullYear();
|
||||
return dayjs(year + "-" + months[month] + "-" + day).format("LL");
|
||||
}
|
||||
}
|
||||
return dateString || null;
|
||||
};
|
||||
|
||||
fetchImage = fetchFile;
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ class ReadwnPlugin implements Plugin.PluginBase {
|
||||
return {
|
||||
name,
|
||||
url: this.site + url,
|
||||
releaseTime: releaseTime,
|
||||
releaseTime,
|
||||
chapterNumber: chapterIndex + 1,
|
||||
};
|
||||
})
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Filters, FilterTypes } from "@libs/filterInputs";
|
||||
import { Plugin } from "@typings/plugin";
|
||||
import { NovelStatus } from "@libs/novelStatus";
|
||||
import { load as parseHTML } from "cheerio";
|
||||
// import { defaultCover } from "@libs/defaultCover";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
export interface RulateMetadata {
|
||||
id: string;
|
||||
@@ -152,7 +152,7 @@ class RulatePlugin implements Plugin.PluginBase {
|
||||
chapters.push({
|
||||
name: chapterName,
|
||||
url: this.site + chapterUrl,
|
||||
releaseTime: releaseDate,
|
||||
releaseTime: this.parseDate(releaseDate),
|
||||
chapterNumber: chapterIndex + 1,
|
||||
});
|
||||
}
|
||||
@@ -210,6 +210,28 @@ class RulatePlugin 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, , time] = dateString.split(" ");
|
||||
if (day && months[month] && year && time) {
|
||||
return dayjs(year + "-" + months[month] + "-" + day + " " + time).format("LLL");
|
||||
}
|
||||
return dateString || null;
|
||||
};
|
||||
|
||||
fetchImage = fetchFile;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user