- Timestamp:
- 10/30/07 10:01:12 (13 months ago)
- Files:
-
- 1 modified
-
lang/lua/LuaScraper/luascraper.lua (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/lua/LuaScraper/luascraper.lua
r867 r868 8 8 end 9 9 -- not supported 10 function result(self) 11 self.name = "result" 12 return self 10 function result(t) 11 return {name="result",list=t} 13 12 end 14 13 -- return scraper structure … … 39 38 if (type(v) == "table" and v.name == "process") then 40 39 if (type(v.process.scraper) == "table") then 40 local newres = {} 41 41 for k1,v1 in pairs(ctx.doc:select(v.process.xpath)) do 42 42 local newctx = {top=ctx.top, doc=v1} 43 self.res[#(self.res)+1] = v.process.scraper.scrape(uri, newctx)43 newres[#(newres)+1] = v.process.scraper.scrape(uri, newctx) 44 44 end 45 self.res[v.process.name] = newres 45 46 else 46 47 local node = ctx.doc:select(v.process.xpath) … … 52 53 attr = string.sub(attr, 2) 53 54 val = node[1]:attribute(attr) 54 nname = node[1]:name()55 nname = node[1]:name() 55 56 if (nname == "img" and attr == "src") or (nname == "a" and attr == "href") then 56 57 if string.sub(uri, -1) == "/" then … … 66 67 end 67 68 end 69 for k,v in pairs(self) do 70 if (type(v) == "table" and v.name == "result") then 71 rres = {} 72 if type(v.list) == "table" then 73 for k1,v1 in pairs(v.list) do 74 rres[k1] = self.res[k1] 75 end 76 else 77 rres[v.list] = self.res[v.list] 78 end 79 self.res = rres 80 end 81 end 68 82 return self.res 69 83 end
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)