Editorial Workflows

Get App Price

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: Queries the iTunes Store API to search for an app's name, returns formatted name and price (in USD) in a popover.

The workflow can optionally create an affiliate link if affiliate information is provided in two variables at the top.

More information on affiliate links and iTunes Search API:

http://www.apple.com/itunes/affiliates/

http://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html#searching

Shared by: viticci

Comments: Comment Feed (RSS)

There are no comments yet.

+ Add Comment

Workflow Preview
Affiliate Token ?
Variable Name
aff_token
Value
&at=10l6nh
Price ?
Variable Name
appPrice
Value
Select from List ?
Title
Tracking Campaign
List (Lines)
Inline &ct=ms_inline Viticci &ct=viticci_twitter Deals &ct=deals_twitter External &ct=ms_externalLink Weekly &ct=ms_weekly Must-Have 2014 &ct=musthave_iphone14
Multiple Selection
OFF
Show in Popover
ON
Affiliate Campaign Tracking ?
Variable Name
aff_ct
Value
Input
Custom UI ?
User Interface
Presentation Style
  • Sheet
  • Full-Screen
  • Popover
Output
Use Editor Theme
ON
Request Text Input ?
Title
App Name
Initial Text
  • Single Line
  • Multiple Lines
Keyboard Options:
Set Variable ?
Variable Name
appname
Value
Input
URL Escape ?
Set Variable ?
Variable Name
URL
Value
http://itunes.apple.com/search?term=Input&country=us&media=software&entity=entity
Run Python Script ?
Source Code
import requests
import workflow
import console

# Given a proper iTunes Search URL, returns a list of results that is passed to the next action with app name, formatted price, and iTunes URL.

iTunesURL = workflow.get_variable('URL')

j = requests.get(iTunesURL)
# print j.json()['results']
s = []

if j.status_code != 200:
	print 'Could not fetch items.\n', j.text
    
elif j.status_code == 200:
	for item in j.json()['results']:
		console.show_activity('Building list...')
		s.append(item['formattedPrice'] + ' - ' + item['trackName'] + '\t' + str(item['trackId']))
		output = '\n'.join(s)
		workflow.set_output(output)
Select from List ?
Title
App Store Results
List (Lines)
Input
Multiple Selection
OFF
Show in Popover
OFF
Fetch with iTunes ?
Source Code
import requests
import workflow
import console

# Given a proper iTunes Search URL, returns a list of results that is passed to the next action with app name, formatted price, and iTunes URL.

iTunesURL = 'http://itunes.apple.com/lookup?id=' + workflow.get_input()
j = requests.get(iTunesURL)
# print j.json()['results']

if j.status_code != 200:
	print 'Could not fetch items.\n', j.text
    
elif j.status_code == 200:
	for item in j.json()['results']:
		workflow.set_output(item['trackViewUrl'])
		workflow.set_variable('appPrice', item['formattedPrice'])
Create Affiliate Link ?
Variable Name
itunesurl
Value
Inputaff_tokenaff_ct
If… ?
Run the block if
Selected Text
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Replace Selected Text ?
Replacement Text
[Selected Text](itunesurl "appname")
Stop ?
Stop
  • This Workflow
  • Repeat Block
Show HUD Alert
OFF
Message
Stopped
…End If
If… ?
Run the block if
Selected Text
  • is Equal to
  • is Not Equal to
  • Contains
  • Doesn't Contain
  • Matches Regular Expression
Replace Selected Text ?
Replacement Text
[appPrice](itunesurl "appname")
Stop ?
Stop
  • This Workflow
  • Repeat Block
Show HUD Alert
OFF
Message
Stopped
…End If