mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Correctly parse names out of itemprop/author segments
If these nodes are setup correctly with structured data, parse out the name instead of taking the entire textContent.
This commit is contained in:
parent
eb920eeae8
commit
cc77e72a5b
1 changed files with 8 additions and 3 deletions
|
|
@ -1089,9 +1089,14 @@ Readability.prototype = {
|
|||
var itemprop = node.getAttribute("itemprop");
|
||||
}
|
||||
|
||||
if ((rel === "author" || (itemprop && itemprop.indexOf("author") !== -1) || this.REGEXPS.byline.test(matchString)) && this._isValidByline(node.textContent)) {
|
||||
this._articleByline = node.textContent.trim();
|
||||
return true;
|
||||
if ((rel === "author" || itemprop && itemprop.indexOf("author") !== -1) || this.REGEXPS.byline.test(matchString)) {
|
||||
var allText = node.textContent.trim()
|
||||
var nameText = node.querySelector('span[itemprop="name"]')?.textContent
|
||||
const bylineText = nameText ?? allText
|
||||
if (this._isValidByline(bylineText)) {
|
||||
this._articleByline = bylineText
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Reference in a new issue