Created
July 30, 2017 14:04
-
-
Save ericdke/bce57bf1cded6887db3926a866b0fc9e to your computer and use it in GitHub Desktop.
Flow to get an image from a pnut.io post oembed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if the post oembed does NOT have a "url_expires_at" field: | |
it's not a pnut file, it's safe to use the "url" field from the post oembed | |
else: | |
if "url_expires_at" is NOT past: | |
it's safe to use "url" field from the post oembed | |
else: | |
if there's a "url_immediate" field: | |
use "url_immediate" instead of "url" | |
else: | |
use "file_id" and "file_token_read" from the post oembed to | |
GET /files/{file_id}?file_token_read={file_token_read} | |
this gives a new object if the file hasn't been deleted | |
and from this new object: | |
use the "link" field instead of "url" | |
use the "link_expires_at" field instead of "url_expires_at" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment