| 1 | local http = require "socket.http" |
| 2 | local have_https, https = pcall(require,"https"); |
| 3 | if not have_https then |
| 4 | have_https, https = pcall(require,"ssl.https"); |
| 5 | end |
| 6 | local csv = require "csv" |
| 7 | |
| 8 | for line in io.lines(arg[1] or "gsoc15.csv") do |
| 9 | local project = {}; |
| 10 | csv.read_record(line, function (v) project[#project+1] = v; end); |
| 11 | local url = project[4] and project[4]:match("https?://[^\"]+"); |
| 12 | if url and url:match("^http"..(have_https and "s?" or "")..":") then |
| 13 | local data, err = http.request(url); |
| 14 | if not data then |
| 15 | print("[FAIL] "..project[2]..": "..tostring(err)); |
| 16 | elseif data:match("[%W%p][Ll][Uu][Aa][%W%p]") then |
| 17 | print(project[2]..": "..url); |
| 18 | end |
| 19 | elseif project[2] ~= "Name" then |
| 20 | print("[FAIL] "..project[2]..": Couldn't fetch URL ("..(url or "couldn't find one")..")"); |
| 21 | end |
| 22 | end |