Check og:title before title tag

This commit is contained in:
Pavel Djundik 2017-06-22 22:41:05 +03:00 committed by GitHub
parent f55d765aae
commit 015a9fb6ef

View File

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