triggerdotdev / jsonhero-web

JSON Hero is an open-source, beautiful JSON explorer for the web that lets you browse, search and navigate your JSON files at speed. πŸš€. Built with πŸ’œ by the Trigger.dev team.
https://jsonhero.io
Apache License 2.0
9.01k stars 482 forks source link

Replace peekalink with OpenGraph Ninja API #157

Closed SSHari closed 1 year ago

SSHari commented 1 year ago

PR to switch from Peekalink to OpenGraph Ninja. Switching to the OpenGraph Ninja API was fairly straightforward, but there are a few differences that should be called out:

  1. OpenGraph provides alt tag information, so I added that to the PreviewHtml component
  2. OpenGraph doesn't provide an icon image in the response, but it does return a website's favicon image. I switched the icon image to point to this instead
  3. OpenGraph doesn't provide additional information for Twitter or Youtube (e.g. likeCount). Without this data available, it didn't seem to make sense to keep the PreviewProperties logic in the PreviewHtml component, so I removed it.

It does look like in some cases at least, OpenGraph is doing better than Peekalink. I tried to preview an API Hero blog post in the currently deployed version of the app and it couldn't generate a preview: https://jsonhero.io/j/zGYmkaZxqyyf.

image

In my local version of the app which is using OpenGraph, it does seem to load the preview correctly:

image

I think whether or not we want to move forward with this change depends on how important point 3 is above. Given that OpenGraph is free, this tradeoff might be acceptable, but ultimately the maintainers of JSON Hero will need to decide.

Bounty: /claim #10

ericallam commented 1 year ago

This looks great! Regarding point 3 above, it's fine if we lose the PreviewProperties since OpenGraph doesn't support it. I'll review this PR shortly and leave any comments in the review πŸ‘