Editorial Workflows

get page contents

unlisted 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: This workflow has no description.

Shared by: @pfcbenjamin

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
Set Variable ?
Variable Name
links
Value
Set Variable ?
Variable Name
titles
Value
Run Python Script ?
Source Code
#coding: utf-8
import workflow
import urllib
import re

link_regex = '(/news-events/bethlehem-blogs/bethlehem-updates-blog/sermon.+)"'
title_regex = '>(Sermon .+)</a>'

url = 'http://www.hopeingod.org/updates'
page = urllib.urlopen(url)
page = page.read()
links = re.findall(link_regex,page)
titles = re.findall(title_regex,page)
from collections import OrderedDict
links = list(OrderedDict.fromkeys(links)) # removes duplicate listings - found here http://stackoverflow.com/questions/7961363/python-removing-duplicates-in-lists
titles = list(OrderedDict.fromkeys(titles))

#workflow.set_output('\n'.join(titles))
workflow.set_variable('links','\n'.join(links))
workflow.set_variable('titles','\n'.join(titles))
Select from List ?
Title
Select your post
List (Lines)
titles
Multiple Selection
OFF
Show in Popover
ON
Set Variable ?
Variable Name
pagetext
Value
Run Python Script ?
Source Code
#coding: utf-8
import workflow
import urllib

select = workflow.get_input()
titledict = workflow.get_variable(titles)
linkdict = workflow.get_variable(links)
labels = dict(zip(titledict.split(),linkdict.split()))

#TODO: Generate the output...
url = labels[select]
page = urllib.urlopen(url)
text = page.read()

workflow.set_variable('pagetext',text)
Get Current File Name ?
Include Folder
ON
Include Extension
ON
Set File Contents ?
File Name
%var:Input
In Dropbox
ON
New Text
pagetext
If File Does Not Exist
  • Create
  • Stop Workflow