Editorial Workflows

App Store Linker

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: App Store Linker generates App Store Affiliate Links for Mac, iPhone and iPad apps.

While writing, simply select the text with the apps name and run the workflow. You will be presented with a list of possible matches, upon tapping on the correct item, the selected text will be replaced with a markdown link.


Shared by: http://blog.plobo.net/post/58794841564/editorial-workflows

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
Info ?
Text
Before beginning, there are some variables that need to be set, your affiliate link, the app store and the list limit (the search won't always return the correct match in the first case)
Set Variable ?
Variable Name
AffiliateLink
Value
Set Variable ?
Variable Name
ListLimit
Value
10
Set Variable ?
Variable Name
AppName
Value
Selected Text
If… ?
Run the block if
AppName
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Stop ?
Stop
  • This Workflow
  • Repeat Block
Show HUD Alert
ON
Message
Select some text first.
…End If
Show Alert ?
Title
App Type
Message
Select the type of app.
Button 1
Mac
Output Value
macSoftware
Button 2
iPhone
Output Value
software
Button 3
iPad
Output Value
iPadSoftware
Show Cancel Button
ON
Set Variable ?
Variable Name
Entity
Value
Input
Run Python Script ?
Source Code
#coding: utf-8
import workflow
import requests
import urllib2


# Define some needed parameters
itunes_search = 'https://itunes.apple.com/search'

affiliateLink = workflow.get_variable('AffiliateLink')
listLimit = workflow.get_variable('ListLimit')
entity = workflow.get_variable('Entity')
app = workflow.get_variable('AppName')


payload = {'media':'software','limit':listLimit,'entity':entity,'term':app}

r = requests.get(itunes_search, params=payload)
data = r.json()

i = 0
appList=[]

for apps in data['results']:
	appUrl = urllib2.quote(data['results'][i]['trackViewUrl'] + '&partnerId=30', '')
	appUrl = urllib2.quote(appUrl, '')
	
	appName = data['results'][i]['trackCensoredName'] + ' (by '+data['results'][i]['sellerName'] + ')\t' + affiliateLink + appUrl
	appList.append(appName)
	i = i+1

action_out = '\n'.join(appList)

workflow.set_output(action_out)
Select from List ?
Title
List (Lines)
Input
Multiple Selection
OFF
Show in Popover
ON
Set Variable ?
Variable Name
appURL
Value
Input
Set Variable ?
Variable Name
initialSel
Value
Sel. Range: Start:Sel. Range: End
Show Alert ?
Title
Link Type
Message
Insert inline or reference link?
Button 1
Inline
Output Value
inline
Button 2
Reference
Output Value
reference
Button 3
(don't show)
Output Value
Show Cancel Button
ON
Insert inline link. ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
inline
Replace Selected Text ?
Replacement Text
[Selected Text](appURL)
Show HUD ?
HUD Text
Link inserted!
Duration
  • 1 Second
  • 2 Seconds
  • 3 Seconds
Icon
  • "Success"
  • "Error"
…End If
Insert reference link. ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
reference
Document Text ?
Folded Text
  • Include
  • Replace with:
Custom Action ?
Set Variable ?
Variable Name
linkName
Value
Input
Move Caret ?
Direction
  • Backward
  • Forward
  • Start/End of Document
  • Start/End of Line
  • Number of Characters:
1
Replace Selected Text ?
Replacement Text
[linkName]: appURL
Select Range ?
Range (from:to)
initialSel
Relative to
  • Entire Document
  • Current Selection
Replace Selected Text ?
Replacement Text
[Selected Text][linkName]
Show HUD ?
HUD Text
Link inserted!
Duration
  • 1 Second
  • 2 Seconds
  • 3 Seconds
Icon
  • "Success"
  • "Error"
…End If