parse.lua

changeset 2
5c9d6eba65bc
parent 0
0e2b5dc7ae34
child 3
5b24d66365ec
--- a/parse.lua	Sat Mar 31 22:10:15 2012 +0100
+++ b/parse.lua	Sat Mar 31 22:13:32 2012 +0100
@@ -2,10 +2,14 @@
 local have_https, https = pcall(require,"https");
 local csv = require "csv"
 
-for line in io.lines("gsoc10.csv") do
+for line in io.lines(arg[1] or "gsoc12.csv") do
 	local project = {};
 	csv.read_record(line, function (v) project[#project+1] = v; end);
-	local url = project[5]:match("https?://[^\"]+");
+	-- 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

mercurial