Editorial Workflows

Insert Pinboard Link

public workflow

Install Workflow...

This workflow contains at least one Python script. Only use it if you trust the person who shared this with you, and if you know exactly what it does.

I understand, install the workflow!

This is a workflow for Editorial, a Markdown and plain text editor for iOS. To download it, you need to view this page on a device that has the app installed.

Description: Choose from recent Pinboard bookmarks.

Shared by: @olemoritz

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
Run Python Script ?
Source Code
#coding: utf-8
import workflow
import console
import keychain
import pickle

login = keychain.get_password('pinboard.in', 'editorial')
if login is not None:
	user, pw = pickle.loads(login)
else:
	user, pw = console.login_alert('Pinboard Login', '')
	login = pickle.dumps((user, pw))
	keychain.set_password('pinboard.in', 'editorial', login)

import requests
import json
pinboard_url = 'https://api.pinboard.in/v1/posts/recent?format=json&count=50'
r = requests.get(pinboard_url, auth=(user, pw))
data = json.loads(r.text)
posts = data['posts']
out = ''
for post in posts:
	title = post['description']
	url = post['href']
	link = '[%s](%s)' % (title, url)
	out += title + '\t' + link + '\n'
if len(out) > 0:
	out = out[:-1]
workflow.set_output(out)
Select from List ?
Title
List (Lines)
Input
Multiple Selection
OFF
Show in Popover
OFF
Replace Selected Text ?
Replacement Text
Input