donatj / PhpUserAgent

Lightning Fast, Minimalist PHP User Agent String Parser.
https://donatstudios.com/PHP-Parser-HTTP_USER_AGENT
MIT License
565 stars 128 forks source link

Link Preview user agent - such as in iMessage or Telegram? #71

Closed yosun closed 3 years ago

yosun commented 3 years ago

Curious if this can be used to definitively know if it's a Link Preview user agent - such as in iMessage or Telegram? (Useful for making sure the graphlink image is sized appropriately etc)

donatj commented 3 years ago

iMessages claims to be both Twitterbot and Facebot. As a general rule of thumb, I try to avoid complex sniffing of things that don't want to be sniffed.

https://medium.com/@siggi/apples-imessage-impersonates-twitter-facebook-bots-when-scraping-cef85b2cbb7d

TelegramBot however I should be able to do. Let me look into that a little.

donatj commented 3 years ago

Ok, so with a little more research, Facebook's bot never actually goes by Facebot, so that makes the sniffing really easy.

donatj commented 3 years ago

This should be resolved in v1.4.0 - thank you for your issue.

https://github.com/donatj/PhpUserAgent/releases/tag/v1.4.0