Sat, 31 Mar 2012 22:13:32 +0100
parse.lua: Update for gsoc12.csv, and *hack* the code to work with the new format
local http = require "socket.http" local have_https, https = pcall(require,"https"); local csv = require "csv" for line in io.lines(arg[1] or "gsoc12.csv") do local project = {}; csv.read_record(line, function (v) project[#project+1] = v; end); -- FIXME: The original code doesn't work this year, -- I think csv.lua doesn't handle quoted values -- (ie. the 'Tags' column) properly. --local url = project[5]:match("https?://[^\"]+"); local url = line:match(",([^,]+)$"); if url and url:match("^http"..(have_https and "s?" or "")..":") then local data, err = http.request(url); if not data then print("[FAIL] "..project[2]..": "..tostring(err)); elseif data:match("[%W%p][Ll][Uu][Aa][%W%p]") then print(project[2]..": "..url); end elseif project[2] ~= "Name" then print("[FAIL] "..project[2]..": Couldn't fetch URL ("..(url or "couldn't find one")..")"); end end