mcbot/cmds/mcabber_bts.lua
changeset 39 237af42156a1
parent 20 d6c602aaa231
child 45 d333cb35e79a
equal deleted inserted replaced
38:a51ddbce247b 39:237af42156a1
    14     local btsurl = "http://bitbucket.org/McKael/mcabber-crew/issue/"
    14     local btsurl = "http://bitbucket.org/McKael/mcabber-crew/issue/"
    15 
    15 
    16     issue.id = tostring(num)
    16     issue.id = tostring(num)
    17     issue.url = btsurl..issue.id.."/"
    17     issue.url = btsurl..issue.id.."/"
    18     local data = shcmd("curl "..issue.url)
    18     local data = shcmd("curl "..issue.url)
       
    19     if not data then return nil end
    19     local title = data:match("#"..issue.id.."%s*-%s*(.*)%s*—")
    20     local title = data:match("#"..issue.id.."%s*-%s*(.*)%s*—")
    20     if not title then return nil end
    21     if not title then return nil end
    21     issue.title = title:gsub(""", "\""):gsub("&", "&")
    22     issue.title = title:gsub(""", "\""):gsub("&", "&")
    22     issue.title = issue.title:gsub("&lt;", "<"):gsub("&gt;", ">")
    23     issue.title = issue.title:gsub("&lt;", "<"):gsub("&gt;", ">")
    23     issue.title = issue.title:gsub("&#39;", "'")
    24     issue.title = issue.title:gsub("&#39;", "'")