Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect resolution when there are multiple Open Graph tags #367

Open
SeriousBug opened this issue Sep 27, 2023 · 3 comments
Open

Incorrect resolution when there are multiple Open Graph tags #367

SeriousBug opened this issue Sep 27, 2023 · 3 comments

Comments

@SeriousBug
Copy link

The Open Graph protocol states that if there are multiple tags, the first one should be preferred in cases of conflicts. See here: https://ogp.me/#array

But article-extractor prefers the last tag. The code gets all the meta tags in the page, and iterates over them. If there are multiple tags, the last one will override earlier ones: https://github.com/extractus/article-extractor/blob/main/src/utils/extractMetaData.js#L98-L127

@ndaidong
Copy link
Collaborator

ndaidong commented Oct 5, 2023

@SeriousBug yes, I consider that if we get all the values and push them into an array, the output will become more complex and not easy to keep consistent.

@SeriousBug
Copy link
Author

Not grabbing all the tags in an array is absolutely a valid design decision. But I think article-extractor should still prefer to scrape the first image rather than the last one.

@ndaidong
Copy link
Collaborator

ndaidong commented Oct 6, 2023

@SeriousBug thank you for your suggestion. I will consider to apply this to the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants