3 local csv = require "csv" |
3 local csv = require "csv" |
4 |
4 |
5 for line in io.lines(arg[1] or "gsoc12.csv") do |
5 for line in io.lines(arg[1] or "gsoc12.csv") do |
6 local project = {}; |
6 local project = {}; |
7 csv.read_record(line, function (v) project[#project+1] = v; end); |
7 csv.read_record(line, function (v) project[#project+1] = v; end); |
8 -- FIXME: The original code doesn't work this year, |
8 local url = project[5] and project[5]:match("https?://[^\"]+"); |
9 -- I think csv.lua doesn't handle quoted values |
|
10 -- (ie. the 'Tags' column) properly. |
|
11 --local url = project[5]:match("https?://[^\"]+"); |
|
12 local url = line:match(",([^,]+)$"); |
|
13 if url and url:match("^http"..(have_https and "s?" or "")..":") then |
9 if url and url:match("^http"..(have_https and "s?" or "")..":") then |
14 local data, err = http.request(url); |
10 local data, err = http.request(url); |
15 if not data then |
11 if not data then |
16 print("[FAIL] "..project[2]..": "..tostring(err)); |
12 print("[FAIL] "..project[2]..": "..tostring(err)); |
17 elseif data:match("[%W%p][Ll][Uu][Aa][%W%p]") then |
13 elseif data:match("[%W%p][Ll][Uu][Aa][%W%p]") then |