fix: fail to display the thumbnail of some webpages
* The regex we use is not strict and it will match og:image:type instead of og:image if there is one
This commit is contained in:
@ -1917,7 +1917,7 @@ Readability.prototype = {
|
||||
var metaElements = this._doc.getElementsByTagName("meta");
|
||||
|
||||
// property is a space-separated list of values
|
||||
var propertyPattern = /\s*(dc|dcterm|og|twitter|article)\s*:\s*(locale|author|creator|description|title|site_name|published_time|published|date|image)\s*/gi;
|
||||
var propertyPattern = /^\s*(dc|dcterm|og|twitter|article)\s*:\s*(locale|author|creator|description|title|site_name|published_time|published|date|image)\s*$/gi;
|
||||
|
||||
// name is a single value
|
||||
var namePattern = /^\s*(?:(dc|dcterm|og|twitter|weibo:(article|webpage))\s*[\.:]\s*)?(author|creator|description|title|site_name|date|image)\s*$/i;
|
||||
@ -2056,7 +2056,7 @@ Readability.prototype = {
|
||||
values["og:image"] ||
|
||||
values["weibo:article:image"] ||
|
||||
values["weibo:webpage:image"] ||
|
||||
jsonld.previewImage
|
||||
jsonld.previewImage;
|
||||
|
||||
metadata.locale = values["og:locale"];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user