Skip to content

Commit

Permalink
Added [DF]HentaiRead #1
Browse files Browse the repository at this point in the history
Also now 9hentai is different
  • Loading branch information
Creckeryop committed Apr 7, 2020
1 parent 1fc47ea commit 3eb410e
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 3 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ This repo is created to store parsers for NOBORU app on PS vita
## Supported Parsers:
**Different:**
* MangaDex
* nhentai
* nhentai (NSFW)
* HentaiRead (NSFW)

**Russian:**
* ReadManga
Expand All @@ -13,6 +14,7 @@ This repo is created to store parsers for NOBORU app on PS vita
* Desu
* NineManga
* Nude-Moon (NSFW)
* NineHentai (NSFW)

**English:**
* MangaHub
Expand All @@ -27,7 +29,6 @@ This repo is created to store parsers for NOBORU app on PS vita
* MangaEden
* NineManga
* PervEden (NSFW)
* NineHentai (NSFW)
* HentaiCafe (NSFW)

**Japan:**
Expand Down
83 changes: 83 additions & 0 deletions parsers/[DF]HentaiRead.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
if u8c then
HentaiRead = Parser:new("HentaiRead", "https://hentairead.com", "DIF", "HENREADDIF", 1)

HentaiRead.NSFW = true
local function stringify(string)
return string:gsub("&#([^;]-);", function(a)
local number = tonumber("0" .. a) or tonumber(a)
return number and u8c(number) or "&#" .. a .. ";"
end)
end

local function downloadContent(link)
local file = {}
Threads.insertTask(file, {
Type = "StringRequest",
Link = link,
Table = file,
Index = "string"
})
while Threads.check(file) do
coroutine.yield(false)
end
return file.string or ""
end

function HentaiRead:getManga(link, dest_table, is_search)
local content = downloadContent(link)
local t = dest_table
local done = true
local regex = 'page%-item%-detail manga">.-href=".-/hentai/([^"]-)/" title="([^"]-)".-data%-src="([^"]-)"'
if is_search then
regex = 'row c%-tabs%-item__content">.-href=".-/hentai/([^"]-)/" title="([^"]-)".-data%-src="([^"]-)"'
end
for Link, Name, ImageLink in content:gmatch(regex) do
local manga = CreateManga(stringify(Name), Link, ImageLink, self.ID, self.Link .. "/hentai/" .. Link)
if manga then
t[#t + 1] = manga
done = false
end
coroutine.yield(false)
end
if done then
t.NoPages = true
end
end

function HentaiRead:getLatestManga(page, dest_table)
self:getManga(self.Link .. "/hentai/page/" .. page .. "/?m_orderby=latest&m_order=desc",dest_table)
end

function HentaiRead:getPopularManga(page, dest_table)
self:getManga(self.Link .. "/hentai/page/" .. page .. "/?m_orderby=views&m_order=desc",dest_table)
end

function HentaiRead:searchManga(search, page, dest_table)
self:getManga(self.Link .. "/page/"..page.."/?s="..search.."&post_type=wp-manga&verified=1",dest_table, true)
end

function HentaiRead:getChapters(manga, dest_table)
local content = downloadContent(self.Link.."/hentai/"..manga.Link):match("page%-content%-listing single%-page(.-)</ul>") or ""
for Link, Name in content:gmatch('wp%-manga%-chapter[^>]->[^<]-<a href=".-/hentai/([^"]-)/">.-\n*([^<]-)</a>') do
dest_table[#dest_table+1] = {
Name = stringify(Name):gsub("&emsp;"," "),
Link = Link,
Pages = {},
Manga = manga
}
end
end

function HentaiRead:prepareChapter(chapter, dest_table)
local content = downloadContent(self.Link .."/hentai/".. chapter.Link .. "/english"):match("var chapter_preloaded_images = %[(.-)%]") or ""
local t = dest_table
for Link in content:gmatch('"([^"]-)"') do
t[#t + 1] = Link:gsub("\\/","/")
Console.write("Got " .. t[#t])
end
end

function HentaiRead:loadChapterPage(link, dest_table)
dest_table.Link = link
end
end
2 changes: 1 addition & 1 deletion parsers/[EN]NineHentai.lua → parsers/[DF]NineHentai.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
NineHentai = Parser:new("NineHentai", "https://9hentai.com", "ENG", "NINEHENTAIEN", 2)
NineHentai = Parser:new("NineHentai", "https://9hentai.com", "DIF", "NINEHENTAIEN", 3)

NineHentai.NSFW = true

Expand Down

0 comments on commit 3eb410e

Please sign in to comment.