Editorial Workflows

Read Instapaper Articles

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: Get a list of your Instapaper bookmarks (articles), select one and download it as markdown for convenient reading in Editorial - Preview Markdown.
Bloated Instapaper app is no longer required.
Credit to other workflows that I have relied upon.
[Download fails for some articles - paywalls, certificates etc.]

Shared by: chew-z

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
Add your Instapaper feed url here ?
Variable Name
instapaper_feed
Value
If… ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
https://www.instapaper.com/rss/
Stop ?
Stop
  • This Workflow
  • Repeat Block
Show HUD Alert
ON
Message
Add your Instapaper feed URL
…End If
Creates empty var for the json ?
Variable Name
instapaper_json
Value
Input
Create variable storing article filename ?
Variable Name
filename
Value
Article
Parses the feed and returns the page titles ?
Source Code
#coding: utf-8
import workflow
import feedparser
import json

feed = workflow.get_variable('instapaper_feed')
parse = feedparser.parse(feed)

parse_dict = {item['title']: item['link'] for item in parse['entries']}
parse_titles = '\n'.join(parse_dict.keys())
instapaper_json = json.dumps(parse_dict)

workflow.set_variable('instapaper_json', instapaper_json)
workflow.set_output(parse_titles)
Select from List ?
Title
Select an Article
List (Lines)
Input
Multiple Selection
OFF
Show in Popover
ON
Scrap page of selected bookmark as markdown ?
Source Code
#coding: utf-8
import workflow
import json
import requests
import html2text


def get_page(url):
  try:
    headers = {
    'User-Agent': 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)',
    'Referer': 'https://www.google.com/'
    }
    response = requests.get(url, headers=headers)
    # print(response.headers)
    # requests stick to RFC assuming ISO-8859-1
    if response.encoding == 'ISO-8859-1':
      response.encoding = 'UTF-8'
    return response.text
  except Exception as err:
    sys.stderr.write('ERROR: %s\n' % str(err))

h = html2text.HTML2Text()
h.ignore_links = True
h.skip_internal_links = True
h.ignore_images = True
h.body_width = 0
h.unicode_snob = True
instapaper_json = json.loads(workflow.get_variable('instapaper_json'))
article_title = workflow.get_input()
# print(article_title)
url = instapaper_json[article_title]
# print(url)
workflow.set_variable('filename', article_title + '.md')
try:
  html = get_page(url)
  text = h.handle(html)
  workflow.set_output(text)
except Exception as err:
  sys.stderr.write('ERROR: %s\n' % str(err))
Create Document ?
Filename
filename
Content
Input
Open in Editor
ON