feat: enhance metadata extraction by including 'itemprop' attribute in HTML (#1624)

This commit is contained in:
Ademílson Tonato 2025-06-03 17:16:46 +01:00 committed by GitHub
parent e108ff3525
commit 41897139da
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -124,7 +124,7 @@ pub unsafe extern "C" fn extract_metadata(html: *const libc::c_char) -> *mut lib
let meta = meta.as_node().as_element().unwrap();
let attrs = meta.attributes.borrow();
if let Some(name) = attrs.get("name").or_else(|| attrs.get("property")) {
if let Some(name) = attrs.get("name").or_else(|| attrs.get("property")).or_else(|| attrs.get("itemprop")) {
if let Some(content) = attrs.get("content") {
if let Some(v) = out.get(name) {
match v {

View File

@ -133,7 +133,7 @@ export async function extractMetadata(
// Extract all meta tags for custom metadata
soup("meta").each((i, elem) => {
try {
const name = soup(elem).attr("name") || soup(elem).attr("property");
const name = soup(elem).attr("name") || soup(elem).attr("property") || soup(elem).attr("itemprop");
const content = soup(elem).attr("content");
if (name && content) {