From dfb3f0a0111c94e951f838e155e03ffb1935ceef Mon Sep 17 00:00:00 2001 From: nyagami Date: Fri, 26 Apr 2024 23:16:54 +0700 Subject: [PATCH] added EpikNovel (#909) --- icons/src/tr/epiknovel/icon.png | Bin 0 -> 1500 bytes .../{epiknovel.broken.ts => epiknovel.ts} | 57 +++++++++--------- 2 files changed, 27 insertions(+), 30 deletions(-) create mode 100644 icons/src/tr/epiknovel/icon.png rename plugins/turkish/{epiknovel.broken.ts => epiknovel.ts} (66%) diff --git a/icons/src/tr/epiknovel/icon.png b/icons/src/tr/epiknovel/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..c7b779d40cd67fd80cdcdb3f8471a75de82f8fc1 GIT binary patch literal 1500 zcmV<21ta>2P)wjOTp(GYATsYq49?U@>-p4Rn#kCf8p;7$ZS&WTf=fJ=~DS3KJ&6*f3G%+N? zwseTh#F5yBwK~KqVX}yjH@&m#`CTri`Iok@mY#%@y$`!`>>?z`{VdM2Jwc9 zo~uqG{g{tSaoz;?4$Iqr1CPnhR3b91?8N^5{?S9+oSgw^7W{?avPu6VU2_*5aoyA|cAOk|n}25;g{{8NZ* zk+{*F1@=f1*>4n2Uaf1f$sp2$GbHexBSzlFyZ9q+ zl|We=>LxN<%Gt}sLv`anlI`9pRbs8ElgKQI5kC~QYGV-3;#U&kH`lo4hp3B4FV4n~ zaC|Y=lBj;SG#Z{8b$>$)y|U|VKd=rgm7VA&u~uy1Uc4>7IsKgV4XFGxG+L?L^mka|%n#Z{6CmnKt{$SkSL&yX6Nyycs4pO83Inhlpr zKzvWqk{P0oXGf>a^WBfY9)yT(@Fx8j+O!Ob`oPvDo5SgzBF=BtI&ed6(MH3dXw+dTms#2+LP zJWOolbo?5(OL90G??}DAO;oe5tT0uG>?ajo8>_|0KPmauIkG!H5rM}-cOqH3g<6Hk z4k@hKXo^ami*L*BTqQd-78Z!H&n)g6kMOvtLS#s~=`FFB!*RZNu>avYW0Pn|M`fAR zC@pairHibdvJ<65T`y#Iii-R~jDLmH>+LnVKcu<6Ts#^faJ${>`+Y)H_d6i!vqGoV z__WmUP1%{I?7(d4U!5Y=;^Ja#qjc=oR1u_6c4Be#))w#w(keZ=xZErRY>KOG2+=;V zi&@2ef0A8Xr7-lVI(pkBf$n$sjCiqwr4Rg(o@#;ZSSiA+ywiGnE|MD3`<*AwU>hEhbbh4liB+9MMx_2;EM@I9 zG2UK$LbByK;+7AQ3UQruSpKU}tB(T_lD%#eRavZK{0l_w4iGXUa-K3^l&6~NGsJE@ zD_xUggh-!sOol}GK~cR;V?Ce@Cad>5P<-adF6yKAMGr* zuT#@coT&eo57Q;HogqT*uzT~ZeNS&OzFke-#t#5yYh;YyFpS>-0000, ): Promise { - let url = this.baseUrl + 'seri-listesi?Sayfa=' + pageNo; + let url = this.site + 'seri-listesi?Sayfa=' + pageNo; const result = await fetch(url); const body = await result.text(); @@ -23,17 +22,17 @@ class EpikNovel implements Plugin.PluginBase { let novels: Plugin.NovelItem[] = []; - loadedCheerio('div.col-lg-12.col-md-12').each(function () { - const novelName = loadedCheerio(this).find('h3').text(); - const novelCover = loadedCheerio(this).find('img').attr('data-src'); - const novelUrl = loadedCheerio(this).find('h3 > a').attr('href'); + loadedCheerio('div.col-lg-12.col-md-12').each((idx, ele) => { + const novelName = loadedCheerio(ele).find('h3').text(); + const novelCover = loadedCheerio(ele).find('img').attr('data-src'); + const novelUrl = loadedCheerio(ele).find('h3 > a').attr('href'); if (!novelUrl) return; const novel = { name: novelName, cover: novelCover, - url: novelUrl, + path: novelUrl.replace(this.site, ''), }; novels.push(novel); @@ -43,8 +42,8 @@ class EpikNovel implements Plugin.PluginBase { return novels; } - async parseNovelAndChapters(novelUrl: string): Promise { - const url = novelUrl; + async parseNovel(novelPath: string): Promise { + const url = this.site + novelPath; // console.log(url); const result = await fetch(url); @@ -52,9 +51,10 @@ class EpikNovel implements Plugin.PluginBase { let loadedCheerio = parseHTML(body); - let novel: Plugin.SourceNovel = { url }; - - novel.name = loadedCheerio('h1#tables').text().trim(); + let novel: Plugin.SourceNovel = { + path: novelPath, + name: loadedCheerio('h1#tables').text().trim(), + }; novel.cover = loadedCheerio('img.manga-cover').attr('src'); @@ -81,18 +81,16 @@ class EpikNovel implements Plugin.PluginBase { loadedCheerio('table') .find('tr') - .each(function () { - const releaseDate = loadedCheerio(this).find('td:nth-child(3)').text(); + .each((idx, ele) => { + const releaseDate = loadedCheerio(ele).find('td:nth-child(3)').text(); - let chapterName = loadedCheerio(this) - .find('td:nth-child(1) > a') - .text(); + let chapterName = loadedCheerio(ele).find('td:nth-child(1) > a').text(); - if (loadedCheerio(this).find('td:nth-child(1) > span').length > 0) { + if (loadedCheerio(ele).find('td:nth-child(1) > span').length > 0) { chapterName = '🔒 ' + chapterName; } - const chapterUrl = loadedCheerio(this) + const chapterUrl = loadedCheerio(ele) .find(' td:nth-child(1) > a') .attr('href'); @@ -100,7 +98,7 @@ class EpikNovel implements Plugin.PluginBase { novelChapters.push({ name: chapterName, - url: chapterUrl, + path: chapterUrl.replace(this.site, ''), releaseTime: releaseDate, }); }); @@ -110,8 +108,8 @@ class EpikNovel implements Plugin.PluginBase { return novel; } - async parseChapter(chapterUrl: string): Promise { - const url = chapterUrl; + async parseChapter(chapterPath: string): Promise { + const url = this.site + chapterPath; // console.log(url); @@ -134,8 +132,7 @@ class EpikNovel implements Plugin.PluginBase { searchTerm: string, pageNo: number, ): Promise { - const url = - this.baseUrl + 'seri-listesi?q=' + searchTerm + '&Sayfa=' + pageNo; + const url = this.site + 'seri-listesi?q=' + searchTerm + '&Sayfa=' + pageNo; const result = await fetch(url); const body = await result.text(); @@ -144,17 +141,17 @@ class EpikNovel implements Plugin.PluginBase { let novels: Plugin.NovelItem[] = []; - loadedCheerio('div.col-lg-12.col-md-12').each(function () { - const novelName = loadedCheerio(this).find('h3').text(); - const novelCover = loadedCheerio(this).find('img').attr('data-src'); - const novelUrl = loadedCheerio(this).find('h3 > a').attr('href'); + loadedCheerio('div.col-lg-12.col-md-12').each((idx, ele) => { + const novelName = loadedCheerio(ele).find('h3').text(); + const novelCover = loadedCheerio(ele).find('img').attr('data-src'); + const novelUrl = loadedCheerio(ele).find('h3 > a').attr('href'); if (!novelUrl) return; const novel = { name: novelName, cover: novelCover, - url: novelUrl, + path: novelUrl.replace(this.site, ''), }; novels.push(novel);