Skip to content

Commit

Permalink
[NHentai] Updated thumbnail parser #21
Browse files Browse the repository at this point in the history
close #21
  • Loading branch information
Creckeryop committed Jul 7, 2022
1 parent 820daf6 commit b93c41d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion parsers/[DF]nhentai.lua
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nhentai=Parser:new("nhentai","https://nhentai.to","DIF","NHENTAI",3)nhentai.NSFW=true;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 nhentai:getManga(f,h)local i=e(f)h.NoPages=true;for j,k,l in i:gmatch('class="gallery".-href="(%S-)".-data%-src="(%S-)".->([^<]-)</div>')do h[#h+1]=CreateManga(a(l),j,k,self.ID,self.Link..j)h.NoPages=false;coroutine.yield(false)end end;function nhentai:getPopularManga(m,h)self:getManga(self.Link.."/?page="..m,h)end;function nhentai:searchManga(n,m,h)self:getManga(self.Link.."/search/?q="..n.."&page="..m,h)end;function nhentai:getChapters(o,h)h[#h+1]={Name="Read chapter",Link=o.Link,Pages={},Manga=o}end;function nhentai:prepareChapter(p,h)local i=e(self.Link..p.Link)for f in i:gmatch('class="gallerythumb".-href="(%S-)"')do h[#h+1]=self.Link..f end end;function nhentai:loadChapterPage(f,h)h.Link=e(f):match('image%-container".-src="(%S-)"')end
nhentai=Parser:new("nhentai","https://nhentai.to","DIF","NHENTAI",4)nhentai.NSFW=true;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 nhentai:getManga(f,h)local i=e(f)h.NoPages=true;for j,k,l in i:gmatch('class="gallery".-href="(%S-)".-data%-src="(%S-)".->([^<]-)</div>')do if k:match("^http")==nil then k="https://cdn.nload.xyz"..k end;h[#h+1]=CreateManga(a(l),j,k,self.ID,self.Link..j)h.NoPages=false;coroutine.yield(false)end end;function nhentai:getPopularManga(m,h)self:getManga(self.Link.."/?page="..m,h)end;function nhentai:searchManga(n,m,h)self:getManga(self.Link.."/search/?q="..n.."&page="..m,h)end;function nhentai:getChapters(o,h)h[#h+1]={Name="Read chapter",Link=o.Link,Pages={},Manga=o}end;function nhentai:prepareChapter(p,h)local i=e(self.Link..p.Link)for f in i:gmatch('class="gallerythumb".-href="(%S-)"')do h[#h+1]=self.Link..f end end;function nhentai:loadChapterPage(f,h)h.Link=e(f):match('image%-container".-src="(%S-)"')end
5 changes: 4 additions & 1 deletion source/[DF]nhentai.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
nhentai = Parser:new("nhentai", "https://nhentai.to", "DIF", "NHENTAI", 3)
nhentai = Parser:new("nhentai", "https://nhentai.to", "DIF", "NHENTAI", 4)

nhentai.NSFW = true

Expand Down Expand Up @@ -38,6 +38,9 @@ function nhentai:getManga(link, dt)
local content = downloadContent(link)
dt.NoPages = true
for Link, ImageLink, Name in content:gmatch('class="gallery".-href="(%S-)".-data%-src="(%S-)".->([^<]-)</div>') do
if ImageLink:match("^http") == nil then
ImageLink = "https://cdn.nload.xyz" .. ImageLink
end
dt[#dt + 1] = CreateManga(stringify(Name), Link, ImageLink, self.ID, self.Link .. Link)
dt.NoPages = false
coroutine.yield(false)
Expand Down

0 comments on commit b93c41d

Please sign in to comment.