LeonardoCardoso / SwiftLinkPreview

It makes a preview from an URL, grabbing all the information such as title, relevant texts and images.
https://leocardz.com/swift-link-preview-5a9860c7756f
MIT License
1.37k stars 197 forks source link

FIXED: Amazon links did not contain og tags with the default user agent #155

Open chadpav opened 2 years ago

chadpav commented 2 years ago

Action

ADDED: 'userAgent' with a default value to preserve current behavior ADDED: 'googleBotUserAgent' static which can be used to override the default ADDED: unit tests for Amazon links and tested across several other major ecommerce sites

NOTE: Not only does this fix OG tags for amazon.com links but the pages are way smaller due to Amazon optimizing for google search indexing (huge performance boost for preview response times)

chadpav commented 2 years ago

@LeonardoCardoso I forked and made this change for my project. I'm getting better results with the google bot user agent across all sites but I left the default user agent in place so it doesn't change existing behavior.

I don't often contribute back so let me know if this was the right way to do it and I can update. Hope this helps.