local http = require("http"); local kb = require("keyboard"); local server = libs.server; local items; local titles; local urls; actions.update = function (index) local url; -- url of the rss stream local titleIndex; -- let me choose what line I want to display in list if (index == 0) then url = "http://www.france24.com/fr/france/rss"; titleIndex = 2; else url = "http://www.bfmtv.com/rss/info/flux-rss/flux-toutes-les-actualites/"; titleIndex = 1; end http.get(url, function (err, resp) if (err) then return; end local root = libs.data.fromxml(resp); local channel = root.children[1] titles = {} urls = {} for i=11,#channel.children,1 do local item = channel.children[i] local title = item.children[titleIndex].text local link = item.children[3].text idx = i - 10 titles[idx]=title urls[idx]=link end items = {}; for idx, _ in ipairs(titles) do --print (titles[idx]) --print (urls[idx]) table.insert(items, { type = "item", text = titles[idx] }); end if (index == 0) then server.update({ id = "id1", children = items }); else server.update({ id = "id2", children = items }); end end); end actions.tap = function (index) link = urls[index+1]; os.execute("start " .. link); end actions.closetab = function () kb.stroke("ctrl", "w"); end actions.goup = function () kb.stroke("shift", "space"); end actions.godown = function () kb.stroke("space"); end