parse.lua

changeset 6
39716bd98da1
parent 4
0dc2ccd703e3
child 7
95ab32c0a1ff
equal deleted inserted replaced
5:a8ab5390f881 6:39716bd98da1
3 if not have_https then 3 if not have_https then
4 have_https, https = pcall(require,"ssl.https"); 4 have_https, https = pcall(require,"ssl.https");
5 end 5 end
6 local csv = require "csv" 6 local csv = require "csv"
7 7
8 for line in io.lines(arg[1] or "gsoc12.csv") do 8 for line in io.lines(arg[1] or "gsoc15.csv") do
9 local project = {}; 9 local project = {};
10 csv.read_record(line, function (v) project[#project+1] = v; end); 10 csv.read_record(line, function (v) project[#project+1] = v; end);
11 local url = project[5] and project[5]:match("https?://[^\"]+"); 11 local url = project[5] and project[5]:match("https?://[^\"]+");
12 if url and url:match("^http"..(have_https and "s?" or "")..":") then 12 if url and url:match("^http"..(have_https and "s?" or "")..":") then
13 local data, err = http.request(url); 13 local data, err = http.request(url);

mercurial