forked from GitHub/dbot
Update link.js
change title regex to be non-greedy
This commit is contained in:
parent
509911aae0
commit
e34b46d4e4
@ -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)/gm, " ");
|
body = body.replace(/(\r\n|\n\r|\n)/gm, " ");
|
||||||
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());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user