multi,thread = require("multi"):init() THREAD = multi.integration.THREAD local m = {} m.azlist = {} local queue = multi:newSystemThreadedJobQueue(16) queue:doToAll(function() multi,thread = require("multi"):init() http = require("socket.http") -- This is important end) m.init = queue:newFunction("init",function() local http = require("socket.http") local list = http.request("http://www.mangareader.net/alphabetical") return list end,true) -- return title function m.getList() return m.azlist end function m.storeList(list) local go = false local titles = {} for link,title in list:gmatch("
(.-)
]]) tab.Chapters = {} for link,chapter in data:gmatch([[([^<]+)]]) do if link~="/" and link~="/privacy" then table.insert(tab.Chapters,{Link = "http://www.mangareader.net"..link,Lead = chapter}) end end return tab end) m.getImage = queue:newFunction("getImage",function(pageurl) local http = require("socket.http") local page = http.request(pageurl) return page:match([[id="imgholder.-src="([^"]*)]]) end) m._getPages = queue:newFunction("getPages",function(Link) local http = require("socket.http") local tab = {} local page = http.request(Link) tab.pages = {} tab.nextChapter = "http://www.mangareader.net"..page:match([[Next Chapter:.-href="([^"]*)]]) for link,page in page:gmatch([[]]) do table.insert(tab.pages,"http://www.mangareader.net"..link) end return tab end) -- returns pages m.getPages = function(chapter) local http = require("socket.http") local tab = {} local page = http.request(chapter.Link) tab.pages = {chapter.Link} tab.nextChapter = "http://www.mangareader.net"..page:match([[Next Chapter:.-href="([^"]*)]]) for link,page in page:gmatch([[]]) do table.insert(tab.pages,"http://www.mangareader.net"..link) end return tab.pages end return m