Link module title regexp fix

Fix for sites that use <\/title> instead of </title> to close their title elements.
This commit is contained in:
Scritches 2018-04-14 13:38:28 -04:00
parent 71c2c52d47
commit 86d0a6f31b

View File

@ -27,7 +27,7 @@ var link = function(dbot) {
page = request(link.replace('https', 'http'), function(error, response, body) { page = request(link.replace('https', 'http'), function(error, response, body) {
if(!error && response.statusCode == 200) { if(!error && response.statusCode == 200) {
body = body.replace(/(\r\n|\n\r|\n)/gim, " "); body = body.replace(/(\r\n|\n\r|\n)/gim, " ");
var title = body.valMatch(/<title>(.*?)<\/title>/, 2); var title = body.valMatch(/<title>(.*?)<\\?\/title>/, 2);
if(title && title.length < 140) { if(title && title.length < 140) {
callback(ent.decode(title[1]).trim()); callback(ent.decode(title[1]).trim());
} }