Skip to content

Commit

Permalink
Added (PervEden, MangaEden) ENG and ITA #1
Browse files Browse the repository at this point in the history
  • Loading branch information
Creckeryop committed Feb 10, 2020
1 parent acb9100 commit 9b410d4
Show file tree
Hide file tree
Showing 2 changed files with 125 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ English:
* MangaKakalot
* MangaNelo
* VLComic
* MangaEden
* PervEden (NSFW)
* NineHentai (NSFW)
* HentaiCafe (NSFW)

Expand All @@ -41,6 +43,10 @@ Turkish:
* Mabushimajo
* MangaTR (0.33+)

Italian:
* MangaEden
* PervEden (NSFW)

## Cloudflare-sites
Parsers in this folder will work if there will be the way to bypass cloudflare with cURL or sites will remove cloudflare thing (that will never happen).

Expand Down
119 changes: 119 additions & 0 deletions parsers/[EN][IT]PervMangaEden.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
MangaEdenIt = Parser:new("MangaEden Italy", "https://www.mangaeden.com", "ITA", "MAEDENITA")

MangaEdenIt.API = "/api/list/1/"
MangaEdenIt.Site = "mangaeden"
local notify = false

local function stringify(string)
if not u8c then
if not notify then
Notifications.push("Please update app, to see fixed titles")
notify = true
end
return string
end
return string:gsub("\\u(....)",function(a) return u8c(tonumber(string.format("0x%s",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 MangaEdenIt:getManga(dest_table, sort, filter)
local content = downloadContent(self.Link..self.API)
local t = {}
for h, id, img, ld, Name in content:gmatch('"h": (%d-),[^}]-"i": "(%S-)",[^}]-"im": (%S-),[^}]-"ld": (%S-),[^}]-"t": "([^"]-)"') do
t[#t + 1]={h = tonumber(h), id = id, img = img=="null" and "" or "cdn."..self.Site..".com/mangasimg/"..(img:match('"(%S-)"') or "") or "", ld = tonumber(ld), Name = Name}
if #t % 50 == 0 then
coroutine.yield(false)
end
end
table.sort(t, sort)
for _, m in ipairs(t) do
local name = stringify(m.Name)
if filter and name:upper():find(filter:upper()) or not filter then
dest_table[#dest_table+1] = CreateManga(name, m.id, m.img, self.ID, m.id)
end
if _ % 50 == 0 then
coroutine.yield(false)
end
end
end

function MangaEdenIt:getPopularManga(page, dest_table)
self:getManga(dest_table, function(a,b) return a.h > b.h end )
dest_table.NoPages = true
end

function MangaEdenIt:getLatestManga(page, dest_table)
self:getManga(dest_table, function(a,b) return a.ld > b.ld end )
dest_table.NoPages = true
end

function MangaEdenIt:searchManga(search, page, dest_table)
local old_gsub = string.gsub
string.gsub = function(self, one, sec)
return old_gsub(self, sec, one)
end
search = search:gsub("!", "%%%%21"):gsub("#", "%%%%23"):gsub("%$", "%%%%24"):gsub("&", "%%%%26"):gsub("'", "%%%%27"):gsub("%(", "%%%%28"):gsub("%)", "%%%%29"):gsub("%*", "%%%%2A"):gsub("%+", "%%%%2B"):gsub(",", "%%%%2C"):gsub("%.", "%%%%2E"):gsub("/", "%%%%2F"):gsub(" ", "%+"):gsub("%%", "%%%%25")
Console.write(search)
string.gsub = old_gsub
self:getManga(dest_table,function(a,b) return a.ld > b.ld end, search)
dest_table.NoPages = true
end

function MangaEdenIt:getChapters(manga, dest_table)
local content = downloadContent(self.Link.."/api/manga/"..manga.Link):match('"chapters"(.-)"chapters_len"') or ""
local t = {}
for num, title, id in content:gmatch('%[%s-(%S-),[^,%]]-,[^%]]-([^,]-),[^%]]-"([^"]-)"[^%]]-%]') do
t[#t + 1] = {
Name = num.." : "..stringify(title:match("\"(%S-)\"") or manga.Name),
Link = id,
Pages = {},
Manga = manga
}
end
for i = #t, 1, -1 do
dest_table[#dest_table + 1] = t[i]
end
end

function MangaEdenIt:prepareChapter(chapter, dest_table)
local content = downloadContent(self.Link.."/api/chapter/"..chapter.Link):match('images"(.-)$')
local t = {}
for link in content:gmatch('"(%S-)"') do
t[#t + 1] = "cdn."..self.Site..".com/mangasimg/"..link
Console.write("Got " .. t[#t])
end
for i = #t, 1, -1 do
dest_table[#dest_table + 1] = t[i]
end
end

function MangaEdenIt:loadChapterPage(link, dest_table)
dest_table.Link = link
end

MangaEdenEn = MangaEdenIt:new("MangaEden English", "https://www.mangaeden.com", "ENG", "MAEDENENG")

MangaEdenEn.API = "/api/list/0/"

PervEdenIt = MangaEdenIt:new("PervEden Italy", "http://www.perveden.com", "ITA", "PVEDENITA")

PervEdenIt.Site = "perveden"
PervEdenIt.NSFW = true

PervEdenEn = MangaEdenEn:new("PervEden English", "http://www.perveden.com", "ENG", "PVEDENENG")

PervEdenEn.Site = "perveden"
PervEdenEn.NSFW = true

0 comments on commit 9b410d4

Please sign in to comment.