From 03456df11531d505d6ac1d42356b9e3f682ad807 Mon Sep 17 00:00:00 2001 From: Creckeryop Date: Fri, 15 Jul 2022 19:43:53 +0500 Subject: [PATCH] Added TruyengiHot #1 request from https://github.com/Creckeryop/NOBORU-parsers/issues/1#issuecomment-1184660128 (Search doesn't work on site so in Noboru too) --- README.md | 46 ++++++++++----------- parsers/[VI]TruyengiHot.lua | 1 + source/[VI]TruyengiHot.lua | 82 +++++++++++++++++++++++++++++++++++++ 3 files changed, 106 insertions(+), 23 deletions(-) create mode 100644 parsers/[VI]TruyengiHot.lua create mode 100644 source/[VI]TruyengiHot.lua diff --git a/README.md b/README.md index 33e1027..83d7776 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,29 @@ # NOBORU - Parsers This repo is created to store parsers for NOBORU app on PS vita ## Supported Parsers: -| Different | Russian | English | Japan | Spanish | Portuguese | French | Turkish | Italian | Vietnamese | Polish | German | Brazil | Indonesian | Korean | Thai | -| :-------------: | :-----------: | :---------------: | :-----------: | :----------------: | :--------------: | :---------------: | :-------------: | :-----------: | :--------: | :-----------: | :--------: | :-------: | :--------: | :--------: | :------------: | -| MangaDex | ~~ReadManga~~ | ~~MangaHub~~ | SenManga | LeoManga | Animaregia | ~~LelScanVF~~ | ~~Mabushimajo~~ | ~~MangaEden~~ | TruyenQQ | Phoenix-Scans | NineManga | NineManga | Komikid | manatoki95 | NiceOppai | -| ~~Bato.to*~~ | МангаПоиск | ~~MangaReader~~ | ~~Manga1000~~ | InManga | UnionMangas | ScanFR | Puzzmos | NineManga | | | Wie Manga! | | | | Oremanga | -| LoveHug (RAW) | ~~MintManga~~ | ~~MangaPanda~~ | | ~~Submanga~~ | ~~GoldenMangas~~ | NineManga | ~~MangaTR~~ | | | | | | | | CartoonClub-TH | -| RawDevArt (RAW) | ~~SelfManga~~ | MangaTown | | NineManga | BRMangas | | SeriManga | | | | | | | | | -| | Desu | ~~MangaOwl~~ | | HeavenManga | | | MangaDenizi | | | | | | | | | -| | NineManga | ReadComicsOnline | | ~~TumangaOnline~~ | | | | | | | | | | | | -| | MangaOneLove | MangaKakalot | | ~~MangaDoor~~ | | | | | | | | | | | | -| | Манга-Тян! | MangaNelo | | MangaLibros | | | | | | | | | | | | -| | MangaHubRu | ~~VLComic~~ | | | | | | | | | | | | | | -| | | ~~MangaEden~~ | | | | | | | | | | | | | | -| | | NineManga | | | | | | | | | | | | | | -| | | ~~MangaSee~~ | | | | | | | | | | | | | | -| | | XoXoComics | | | | | | | | | | | | | | -| | | ReadComicOnlineTo | | | | | | | | | | | | | | -| | | Mangafast | | | | | | | | | | | | | | -| | | Reaper Scans | | | | | | | | | | | | | | -| **NSFW** | **NSFW** | **NSFW** | **NSFW** | **NSFW** | **NSFW** | **NSFW** | **NSFW** | **NSFW** | **NSFW** | **NSFW** | **NSFW** | **NSFW** | **NSFW** | **NSFW** | **NSFW** | -| nhentai | Nude-Moon | PervEden | | DoujinHentai | | Histoire d'Hentai | | PervEden | | | | | | | | -| HentaiRead | ~~AllHentai~~ | ~~HentaiCafe~~ | | VerComicsPorno.xxx | | | | | | | | | | | | -| 9hentai | Яой-Тян! | MyHentaiGallery | | | | | | | | | | | | | | -| Hentai Shark | Хентай-Тян! | Hentai20 | | | | | | | | | | | | | | +| Different | Russian | English | Japan | Spanish | Portuguese | French | Turkish | Italian | Vietnamese | Polish | German | Brazil | Indonesian | Korean | Thai | +| :-------------: | :-----------: | :---------------: | :-----------: | :----------------: | :--------------: | :---------------: | :-------------: | :-----------: | :---------: | :-----------: | :--------: | :-------: | :--------: | :--------: | :------------: | +| MangaDex | ~~ReadManga~~ | ~~MangaHub~~ | SenManga | LeoManga | Animaregia | ~~LelScanVF~~ | ~~Mabushimajo~~ | ~~MangaEden~~ | TruyenQQ | Phoenix-Scans | NineManga | NineManga | Komikid | manatoki95 | NiceOppai | +| ~~Bato.to*~~ | МангаПоиск | ~~MangaReader~~ | ~~Manga1000~~ | InManga | UnionMangas | ScanFR | Puzzmos | NineManga | TruyengiHot | | Wie Manga! | | | | Oremanga | +| LoveHug (RAW) | ~~MintManga~~ | ~~MangaPanda~~ | | ~~Submanga~~ | ~~GoldenMangas~~ | NineManga | ~~MangaTR~~ | | | | | | | | CartoonClub-TH | +| RawDevArt (RAW) | ~~SelfManga~~ | MangaTown | | NineManga | BRMangas | | SeriManga | | | | | | | | | +| | Desu | ~~MangaOwl~~ | | HeavenManga | | | MangaDenizi | | | | | | | | | +| | NineManga | ReadComicsOnline | | ~~TumangaOnline~~ | | | | | | | | | | | | +| | MangaOneLove | MangaKakalot | | ~~MangaDoor~~ | | | | | | | | | | | | +| | Манга-Тян! | MangaNelo | | MangaLibros | | | | | | | | | | | | +| | MangaHubRu | ~~VLComic~~ | | | | | | | | | | | | | | +| | | ~~MangaEden~~ | | | | | | | | | | | | | | +| | | NineManga | | | | | | | | | | | | | | +| | | ~~MangaSee~~ | | | | | | | | | | | | | | +| | | XoXoComics | | | | | | | | | | | | | | +| | | ReadComicOnlineTo | | | | | | | | | | | | | | +| | | Mangafast | | | | | | | | | | | | | | +| | | Reaper Scans | | | | | | | | | | | | | | +| **NSFW** | **NSFW** | **NSFW** | **NSFW** | **NSFW** | **NSFW** | **NSFW** | **NSFW** | **NSFW** | **NSFW** | **NSFW** | **NSFW** | **NSFW** | **NSFW** | **NSFW** | **NSFW** | +| nhentai | Nude-Moon | PervEden | | DoujinHentai | | Histoire d'Hentai | | PervEden | | | | | | | | +| HentaiRead | ~~AllHentai~~ | ~~HentaiCafe~~ | | VerComicsPorno.xxx | | | | | | | | | | | | +| 9hentai | Яой-Тян! | MyHentaiGallery | | | | | | | | | | | | | | +| Hentai Shark | Хентай-Тян! | Hentai20 | | | | | | | | | | | | | | **Catalog works with option Preferred Language and deletes extra manga from it*
*strikethrough parsers don't work* diff --git a/parsers/[VI]TruyengiHot.lua b/parsers/[VI]TruyengiHot.lua new file mode 100644 index 0000000..c2dbf2e --- /dev/null +++ b/parsers/[VI]TruyengiHot.lua @@ -0,0 +1 @@ +TruyengiHot=Parser:new("TruyengiHot","https://www.truyengihot.vip","VIE","TRUYENGIHOTVI",1)local function a(b)return b:gsub("&#([^;]-);",function(c)local d=tonumber("0"..c)or tonumber(c)return d and u8c(d)or"&#"..c..";"end):gsub("&(.-);",function(c)return HTML_entities and HTML_entities[c]and u8c(HTML_entities[c])or"&"..c..";"end)end;local function e(f)local g={}Threads.insertTask(g,{Type="StringRequest",Link=f,Table=g,Index="text"})while Threads.check(g)do coroutine.yield(false)end;return g.text or""end;function TruyengiHot:getManga(f,h)local i=e(f)h.NoPages=true;for j,k,l in i:gmatch('href="[^"]*/([^"/]-)%.html" class="cw%-list%-item.-src="([^"]-)" alt="([^"]-)"')do h[#h+1]=CreateManga(a(l),j,k,self.ID,self.Link.."/truyen/"..j..".html")h.NoPages=false;coroutine.yield(false)end end;function TruyengiHot:getPopularManga(m,h)self:getManga(self.Link.."/danh-sach-truyen.html?sort=hot&sort_type=DESC&page="..m,h)end;function TruyengiHot:getLatestManga(m,h)self:getManga(self.Link.."/danh-sach-truyen.html?sort=last_update&sort_type=DESC&page="..m,h)end;function TruyengiHot:searchManga(n,m,h)self:getManga(self.Link.."/danh-sach-truyen.html?name="..n.."&sort=hot&sort_type=DESC&page="..m,h)end;function TruyengiHot:getChapters(o,h)local i=e(self.Link.."/truyen/"..o.Link..".html")local p={}for j,l in i:gmatch('class="episode%-item"[^>]-href="[^"]*/([^"/]-)%.html">.->%s*([^<]-)%s*')do p[#p+1]={Name=a(l),Link=j,Pages={},Manga=o}end;for q=#p,1,-1 do h[#h+1]=p[q]end end;function TruyengiHot:prepareChapter(r,h)local i=e(self.Link.."/chapter/"..r.Link..".html")for j in i:gmatch('data%-src="([^"]-)"')do h[#h+1]=j end end;function TruyengiHot:loadChapterPage(f,h)h.Link=f end \ No newline at end of file diff --git a/source/[VI]TruyengiHot.lua b/source/[VI]TruyengiHot.lua new file mode 100644 index 0000000..411432e --- /dev/null +++ b/source/[VI]TruyengiHot.lua @@ -0,0 +1,82 @@ +TruyengiHot = Parser:new("TruyengiHot", "https://www.truyengihot.vip", "VIE", "TRUYENGIHOTVI", 1) + +local function stringify(string) + return string:gsub( + "&#([^;]-);", + function(a) + local x = tonumber("0" .. a) or tonumber(a) + return x and u8c(x) or "&#" .. a .. ";" + end + ):gsub( + "&(.-);", + function(a) + return HTML_entities and HTML_entities[a] and u8c(HTML_entities[a]) or "&" .. a .. ";" + end + ) +end + +local function downloadContent(link) + local f = {} + Threads.insertTask( + f, + { + Type = "StringRequest", + Link = link, + Table = f, + Index = "text" + } + ) + while Threads.check(f) do + coroutine.yield(false) + end + return f.text or "" +end + +function TruyengiHot:getManga(link, dt) + local content = downloadContent(link) + dt.NoPages = true + for Link, ImageLink, Name in content:gmatch('href="[^"]*/([^"/]-)%.html" class="cw%-list%-item.-src="([^"]-)" alt="([^"]-)"') do + dt[#dt + 1] = CreateManga(stringify(Name), Link, ImageLink, self.ID, self.Link .. "/truyen/" .. Link .. ".html") + dt.NoPages = false + coroutine.yield(false) + end +end + +function TruyengiHot:getPopularManga(page, dt) + self:getManga(self.Link .. "/danh-sach-truyen.html?sort=hot&sort_type=DESC&page=" .. page, dt) +end + +function TruyengiHot:getLatestManga(page, dt) + self:getManga(self.Link .. "/danh-sach-truyen.html?sort=last_update&sort_type=DESC&page=" .. page, dt) +end + +function TruyengiHot:searchManga(search, page, dt) + self:getManga(self.Link .. "/danh-sach-truyen.html?name=" .. search .. "&sort=hot&sort_type=DESC&page=" .. page, dt) +end + +function TruyengiHot:getChapters(manga, dt) + local content = downloadContent(self.Link .. "/truyen/" .. manga.Link .. ".html") + local t = {} + for Link, Name in content:gmatch('class="episode%-item"[^>]-href="[^"]*/([^"/]-)%.html">.->%s*([^<]-)%s*') do + t[#t + 1] = { + Name = stringify(Name), + Link = Link, + Pages = {}, + Manga = manga + } + end + for i = #t, 1, -1 do + dt[#dt + 1] = t[i] + end +end + +function TruyengiHot:prepareChapter(chapter, dt) + local content = downloadContent(self.Link .. "/chapter/" .. chapter.Link .. ".html") + for Link in content:gmatch('data%-src="([^"]-)"') do + dt[#dt + 1] = Link + end +end + +function TruyengiHot:loadChapterPage(link, dt) + dt.Link = link +end