Gk Post Previewer: Fix for additional instagram support

Words
276
Reading
2 min
9y
Listen to this post
~2 min

Quick Background

GK Post Previewer is a wordpress plugin I created few months back with the purpose to allow creating a preview, on any wordpress installation, of any post grabbed from different social media sites, including video and image links.


alt

Instagram Incorrect JSON Data

I received some recent notifications from my plugin users about some instagram videos/posts no longer allowing proper retrieval of the video URLs, which is required for the embedding of the video into their "post preview" post type.
After digging into the issue, it was clear that instagram was not sending the proper values via its json content as you can see in the screenshot below


image.png

and hence the needed video_url property was not being returned/filled.

The standard and correct way for video content json content would be alternatively as below


image.png

Overriding Incorrect Data

This required a fix to be implemented to the plugin to figure out how to retrieve the video URL while instagram is returning that the content is NOT a video, while in the fact, it is.

Digging further into their json returned data for the affected instagram vids, we found an alternative path to grab the related content. This was available under the format of one of inner nodes entries that instagram is sending under "edge_sidecar_to_children" entry within the json data.


image.png

We also performed a quick cleanup onto the existing code, removing no longer needed content.

Commit

The links to the relevant commit can be found here
The plugin has now been boosted into version number 0.3.0, and is available for download via the official github repo



Posted on Utopian.io - Rewarding Open Source Contributors

Gk Post Previewer: Fix for additional instagram support | Ecency