Skip to content

Instantly share code, notes, and snippets.

@manton
Last active November 6, 2021 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save manton/952580bb1e6a60e9f3930cb1882f0a04 to your computer and use it in GitHub Desktop.
Save manton/952580bb1e6a60e9f3930cb1882f0a04 to your computer and use it in GitHub Desktop.
// Get latest Micro.blog photo
let token = "" // set this to a token for Drummer added under Account→ "App tokens"
let blog_url = "" // optional, your blog URL if you have multiple hosted blogs
let s = http.readUrl("https://micro.blog/micropub/media?q=source&access_token=" + token + "&mp-destination=" + blog_url)
const obj = JSON.parse(s)
dialog.alert(obj.items[0].url)
@ericmwalk
Copy link

This was super helpful! I cobbled together from another users scripts these extra two lines replaces your last one. It will then automatically add the last Micro.blog image into the attributes automatically for an inlineImage. The dialog box could be dropped on mine too but I like the feedback.

op.attributes.setOne("inlineImage", obj.items[0].url);
dialog.alert("Image Added")

@manton
Copy link
Author

manton commented Nov 6, 2021

Excellent!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment