parse.lua

changeset 0
0e2b5dc7ae34
child 2
5c9d6eba65bc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/parse.lua	Fri Mar 26 01:30:24 2010 +0000
@@ -0,0 +1,19 @@
+local http = require "socket.http"
+local have_https, https = pcall(require,"https");
+local csv = require "csv"
+
+for line in io.lines("gsoc10.csv") do
+	local project = {};
+	csv.read_record(line, function (v) project[#project+1] = v; end);
+	local url = project[5]:match("https?://[^\"]+");
+	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

mercurial