Merge pull request #1256 from thelounge/xPaw/og-title

Check og:title before title tag
This commit is contained in:
Jérémie Astori 2017-06-26 01:48:07 -04:00 committed by GitHub
commit 5abc4c8c2a

View File

@ -53,7 +53,10 @@ function parse(msg, url, res, client) {
case "text/html": case "text/html":
var $ = cheerio.load(res.text); var $ = cheerio.load(res.text);
toggle.type = "link"; toggle.type = "link";
toggle.head = $("title").text(); toggle.head =
$("meta[property=\"og:title\"]").attr("content")
|| $("title").text()
|| "No title found.";
toggle.body = toggle.body =
$("meta[property=\"og:description\"]").attr("content") $("meta[property=\"og:description\"]").attr("content")
|| $("meta[name=\"description\"]").attr("content") || $("meta[name=\"description\"]").attr("content")