From e10d25be312965a6093051fdbf17d670d2866fcf Mon Sep 17 00:00:00 2001 From: Tran Duy Toan <93266912+tranduytoan@users.noreply.github.com> Date: Tue, 23 Jun 2026 04:06:15 +0700 Subject: [PATCH 1/2] fix(vi/Hako): fix chapter path parsing and decrypt protected chapter content - Fix `parseNovel` extracting full URL instead of relative path for chapters. - Implement decryption logic for protected chapter content (`#chapter-c-protected`) using XOR shuffle, base64 reverse, and plain base64 decoding. --- plugins/vietnamese/LNHako.ts | 62 ++++++++++++++++++++++++++++++++---- 1 file changed, 55 insertions(+), 7 deletions(-) diff --git a/plugins/vietnamese/LNHako.ts b/plugins/vietnamese/LNHako.ts index 042bdcf92..63ad62e9c 100644 --- a/plugins/vietnamese/LNHako.ts +++ b/plugins/vietnamese/LNHako.ts @@ -1,5 +1,6 @@ import { fetchApi } from '@libs/fetch'; import { Parser } from 'htmlparser2'; +import { load as parseHTML } from 'cheerio'; import { HTMLParser2Util, Plugin } from '@/types/plugin'; import { NovelStatus } from '@libs/novelStatus'; import { FilterTypes, Filters } from '@libs/filterInputs'; @@ -223,7 +224,7 @@ class HakoPlugin implements Plugin.PluginBase { this.part++; } this.tempChapter = { - path: attribs['href'], + path: attribs['href']?.replace(/^(https?:\/\/[^/]+)/, ''), name: chapterName, page: this.currentVolume, chapterNumber: chapterNumber, @@ -401,12 +402,39 @@ class HakoPlugin implements Plugin.PluginBase { parseChapter(chapterPath: string): Promise { return fetchApi(this.site + chapterPath) .then(res => res.text()) - .then( - html => - html.match( - /(
[^]+)
[note]', + ); + + protectedEl.replaceWith(decryptedHtml); } } + $('a[href^="/truyen/"]').has('img[src*="chapter-banners"]').remove(); + return $('#chapter-content').html() || 'Không tìm thấy nội dung'; }); }