Skip to content

Commit

Permalink
fix: [FreeWebNovel]: Add Regex to Remove Website Spam (LNReader#1106)
Browse files Browse the repository at this point in the history
* Regex to remove website spam

* v2

* final

* prettier

* 1.0.3 fix

* retry prettier

* retry 2

* Lint

* lint

* lint 2

* lint

* lint

* lint...

* LINT

* LIINT
  • Loading branch information
Palloxin authored Sep 16, 2024
1 parent 36bf6a8 commit 45c767b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/plugins/english/freewebnovel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class FreeWebNovel implements Plugin.PluginBase {
id = 'FWN.com';
name = 'Free Web Novel';
site = 'https://freewebnovel.com';
version = '1.0.2';
version = '1.0.3';
icon = 'src/en/freewebnovel/icon.png';

async getCheerio(url: string): Promise<CheerioAPI> {
Expand Down Expand Up @@ -115,7 +115,15 @@ class FreeWebNovel implements Plugin.PluginBase {
loadedCheerio('div.txt').find('p:last-child').remove();

const chapterText = loadedCheerio('div.txt').html() || '';
return chapterText;
return chapterText
.replace(
/(?:(?<=<p>\s*)(?:This (?:chapter is updated by|content is taken from)|Follow current novels on) )?[ƒfF][Rrɾг][Eēeё][Eēёe][Wwω][Eёēe][Bbɓ][Nnɳη][Oø૦ѳσo][Vѵv][Eёeē][Llℓɭ]\.\s?[Cƈcç][O૦σøoѳ][M๓ɱm]\.?/g,
'',
)
.replace(
/(?<=<p>\s*)Visit for the best novel reading experience\.?/g,
'',
);
}

async searchNovels(searchTerm: string): Promise<Plugin.NovelItem[]> {
Expand Down

0 comments on commit 45c767b

Please sign in to comment.