Editorial Workflows

New Affiliate Link App Store Search

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: Generate new iTunes affiliate links using the new PHG affiliate system.
Checks the clipboard for a link and then suggests to make it an affiliate link from it and puts the link in your clipboard.
If you choose not to make an affiliate link out of it or if you don't have a link in the clipboard, you are asked if you want to search the App Store for a link.

This is my New Affilate Link workflow modified to search the App Store instead of Google.

Shared by: @devsl

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
Set Variable ?
Variable Name
aftoken
Value
10l5UB
Set Variable ?
Variable Name
ListLimit
Value
10
Generate Text ?
Text
Clipboard
Remove Whitespace ?
  • Trim leading/trailing whitespace
  • Remove empty lines
Extract URLs ?
Output
  • Only URLs
  • URLs and Ranges (Separated by Tab)
No Link in the Clipboard ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
://
Show Alert ?
Title
No URL in the Clipboard
Message
Do you want to search for an app's link?
Button 1
Yes
Output Value
Yes
Button 2
No
Output Value
Input
Button 3
(don't show)
Output Value
Show Cancel Button
OFF
Use Search ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Yes
Request Text Input ?
Title
What is the app's name?
Initial Text
Selected Text
  • Single Line
  • Multiple Lines
Keyboard Options:
Set Variable ?
Variable Name
appname
Value
Input
Show Alert ?
Title
App Platform
Message
What platform was the app built for?
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('aftoken')
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'] + '&at=affiliateLink', '')
	appUrl = urllib2.quote(appUrl, '')
	
	appName = data['results'][i]['trackCensoredName'] + ' (by '+data['results'][i]['sellerName'] + ')\t' + appUrl
	appList.append(appName)
	i = i+1

action_out = '\n'.join(appList)

workflow.set_output(action_out)
Select from List ?
Title
Here are the results:
List (Lines)
Input
Multiple Selection
OFF
Show in Popover
ON
Generate Text ?
Text
Input
Find / Replace ?
Find
%252F
  • Case-insensitive (A = a)
  • Case-sensitive (A ≠ a)
  • Regular Expression
Replace with
/
Find / Replace ?
Find
%253A
  • Case-insensitive (A = a)
  • Case-sensitive (A ≠ a)
  • Regular Expression
Replace with
:
Find / Replace ?
Find
%253F
  • Case-insensitive (A = a)
  • Case-sensitive (A ≠ a)
  • Regular Expression
Replace with
?
Find / Replace ?
Find
%253D
  • Case-insensitive (A = a)
  • Case-sensitive (A ≠ a)
  • Regular Expression
Replace with
=
Find / Replace ?
Find
%2526
  • Case-insensitive (A = a)
  • Case-sensitive (A ≠ a)
  • Regular Expression
Replace with
&
Find / Replace ?
Find
affiliateLink
  • Case-insensitive (A = a)
  • Case-sensitive (A ≠ a)
  • Regular Expression
Replace with
aftoken
Set Clipboard ?
Show Alert ?
Title
Search Done
Message
Please rerun the workflow to make an affiliate link from the link in your clipboard.
Button 1
Ok, Bye
Output Value
Clipboard
Button 2
(don't show)
Output Value
Button 3
(don't show)
Output Value
Show Cancel Button
OFF
…End If
Don't Search ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Yes
Done! ?
Stop
  • This Workflow
  • Repeat Block
Show HUD Alert
ON
Message
Done!
…End If
…End If
Link in Clipboard ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
://
Show Alert ?
Title
There's a URL in the Clipboard
Message
Do you want to use it as an affiliate link?
Button 1
Yes
Output Value
Input
Button 2
No
Output Value
Button 3
(don't show)
Output Value
Show Cancel Button
OFF
Use Clipboard ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
://
If ? ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
?
Prefix / Suffix Lines ?
  • Prefix
  • Suffix
Text
&at=aftoken
Set Clipboard ?
…End If
No ? ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
?
Prefix / Suffix Lines ?
  • Prefix
  • Suffix
Text
?at=aftoken
Set Clipboard ?
…End If
…End If
Don't Use Clipboard ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Show Alert ?
Title
Do you want to search for an app's link?
Message
Button 1
Yes
Output Value
y
Button 2
No
Output Value
n
Button 3
(don't show)
Output Value
Show Cancel Button
OFF
Use Search ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Yes
Request Text Input ?
Title
What is the app's name?
Initial Text
Selected Text
  • Single Line
  • Multiple Lines
Keyboard Options:
Set Variable ?
Variable Name
appname
Value
Input
Show Alert ?
Title
App Platform
Message
What platform was the app built for?
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('aftoken')
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'] + '&at=affiliateLink', '')
	appUrl = urllib2.quote(appUrl, '')
	
	appName = data['results'][i]['trackCensoredName'] + ' (by '+data['results'][i]['sellerName'] + ')\t' + appUrl
	appList.append(appName)
	i = i+1

action_out = '\n'.join(appList)

workflow.set_output(action_out)
Select from List ?
Title
Here are the results:
List (Lines)
Input
Multiple Selection
OFF
Show in Popover
ON
Generate Text ?
Text
Input
Find / Replace ?
Find
%252F
  • Case-insensitive (A = a)
  • Case-sensitive (A ≠ a)
  • Regular Expression
Replace with
/
Find / Replace ?
Find
%253A
  • Case-insensitive (A = a)
  • Case-sensitive (A ≠ a)
  • Regular Expression
Replace with
:
Find / Replace ?
Find
%253F
  • Case-insensitive (A = a)
  • Case-sensitive (A ≠ a)
  • Regular Expression
Replace with
?
Find / Replace ?
Find
%253D
  • Case-insensitive (A = a)
  • Case-sensitive (A ≠ a)
  • Regular Expression
Replace with
=
Find / Replace ?
Find
%2526
  • Case-insensitive (A = a)
  • Case-sensitive (A ≠ a)
  • Regular Expression
Replace with
&
Find / Replace ?
Find
affiliateLink
  • Case-insensitive (A = a)
  • Case-sensitive (A ≠ a)
  • Regular Expression
Replace with
aftoken
Set Clipboard ?
Show Alert ?
Title
Search Done
Message
Please rerun the workflow to make an affiliate link from the link in your clipboard.
Button 1
Ok, Bye
Output Value
Clipboard
Button 2
(don't show)
Output Value
Button 3
(don't show)
Output Value
Show Cancel Button
OFF
…End If
Don't Search ?
Run the block if
Input
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Yes
Done! ?
Stop
  • This Workflow
  • Repeat Block
Show HUD Alert
ON
Message
Done!
…End If
…End If
…End If