Editorial Workflows

Image Downloader

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: @hals_pg

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
Text Input ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Selected Text ?
Entire Line(s)
OFF
Empty Selection Output
  • No Output
  • All Text
  • Closest Word
Folded Text
  • Include
  • Replace with:
If… ?
Run the block if
Selected Text
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Request Text Input ?
Title
Image URL
Initial Text
  • Single Line
  • Multiple Lines
Keyboard Options:
If… ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Show HUD ?
HUD Text
Empty input
Duration
  • 1 Second
  • 2 Seconds
  • 3 Seconds
Icon
  • "Success"
  • "Error"
Stop ?
Stop
  • This Workflow
  • Repeat Block
Show HUD Alert
OFF
Message
Stopped
…End If
…End If
…End If
Repeat… ?
Repeat with
  • Every Line
  • Every Match of Regular Expression:
Match Group
0 (entire match)
Reverse
OFF
Image Downloader ?
Source Code
# -*- coding: utf-8 -*-
import sys
import workflow
import console
import requests
import photos
from StringIO import StringIO
from PIL import Image


sys.setdefaultencoding('utf-8')


def main(url):
	headers = {'User-Agent': "Mozilla/5.0 (iPhone; CPU iPhone OS 8_4 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12H143 Safari/600.1.4"}
	console.show_activity()
	conn = requests.get(
		url, headers=headers
	)
	console.hide_activity()
	out = Image.open(
		StringIO(conn.content)
	)
	photos.save_image(out)

if __name__ == '__main__':
    main(workflow.get_input())
…End Repeat
Show HUD ?
HUD Text
Saved
Duration
  • 1 Second
  • 2 Seconds
  • 3 Seconds
Icon
  • "Success"
  • "Error"