-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
request from #1 (comment) (Search doesn't work on site so in Noboru too)
- Loading branch information
1 parent
c5f77be
commit 03456df
Showing
3 changed files
with
106 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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*</span>')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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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*</span>') 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 |