Gk Post Previewer: Fix for additional instagram support
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.
![](https://steemitimages.com/640x0/https://res.cloudinary.com/hpiynhbhq/image/upload/v1511989012/emick3lx6pz2pmdxru9c.png)
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](https://steemitimages.com/640x0/https://res.cloudinary.com/hpiynhbhq/image/upload/v1518543892/lgzafzjk2mnloxodwrdf.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](https://steemitimages.com/640x0/https://res.cloudinary.com/hpiynhbhq/image/upload/v1518544667/ravhxwqvn75xfy87syxx.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](https://steemitimages.com/640x0/https://res.cloudinary.com/hpiynhbhq/image/upload/v1518544199/r1asmvbvs4zwdo3tid9x.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
Thank you for the contribution. It has been approved.
You can contact us on Discord.
[utopian-moderator]
You've got upvoted by
Utopian-1UP
!You can give up to ten 1UP's to Utopian posts every day after they are accepted by a Utopian moderator and before they are upvoted by the official @utopian-io account. Install the @steem-plus browser extension to use 1UP. By following the 1UP-trail using SteemAuto you support great Utopian authors and earn high curation rewards at the same time.
1UP is neither organized nor endorsed by Utopian.io!
Creative mind, keep it up.
good informations @mcfarhat
tthank you for sharing
Thank you for the contribution. It has been approved.
You can contact us on Discord.
[utopian-moderator]
Thank you for the contribution. It has been approved.
You can contact us on Discord.
[utopian-moderator]