Skip to content

Instantly share code, notes, and snippets.

Last active March 29, 2022 10:27
Show Gist options
  • Save moxmlb/a66f1592fb145ff5517d6028bc697880 to your computer and use it in GitHub Desktop.
Save moxmlb/a66f1592fb145ff5517d6028bc697880 to your computer and use it in GitHub Desktop.
Scriptable iOS widget that shows the current price of your favorite movie on iTunes Store
let movieId, country, quality
if (country == null && movieId == null && quality == null) {
country = 'de'
movieId = 991367195 //example id for Minions movie
quality = 'hd'
// api link
let link = ''
let widgetInputRAW = args.widgetParameter;
let widgetInput = null;
// get widget input, seperated by |
if (widgetInputRAW !== null) {
[movieId, country, quality] = widgetInputRAW.toString().split("|");
var backgroundColor, textColor
if (Device.isUsingDarkAppearance()) {
backgroundColor =
textColor = Color.white()
} else {
backgroundColor = Color.white()
textColor =
const widget = new ListWidget()
const result = await fetchiTunesInfo()
await createWidget()
if (!config.runsInWidget) {[0].trackViewUrl.toString())
await widget.presentSmall()
async function createWidget() {
widget.setPadding(10, 10, 10, 10)
let titleText = widget.addText(result.results[0].trackName)
titleText.textColor = textColor
titleText.font = Font.boldSystemFont(20)
titleText.minimumScaleFactor = 0.5
const artwork = await getImage('movieArtwork.jpg')
let image = widget.addImage(artwork)
var priceBuyText = ''
if (quality == 'sd') {
priceBuyText = widget.addText(result.results[0].trackPrice.toString() + " " + result.results[0].currency.toString())
else {
priceBuyText = widget.addText(result.results[0].trackHdPrice.toString() + " " + result.results[0].currency.toString())
priceBuyText.font = Font.mediumRoundedSystemFont(13)
priceBuyText.textColor = textColor
async function fetchiTunesInfo() {
let url
var price = 0.0
url = link + 'country=' + country + '&id=' + movieId
const req = new Request(url)
const apiResult = await req.loadJSON()
return apiResult
async function getImage(image) {
let imageUrl = result.results[0].artworkUrl100.replace('100x100', '1000x1000')
let movieImage = await loadImage(imageUrl)
return movieImage
async function loadImage(imgUrl) {
const req = new Request(imgUrl)
return await req.loadImage()
Copy link

moxmlb commented Oct 25, 2020


The iTunes movie widget displays your favorite movie and its price. The movie ID, store country and quality can be set by parameters.
It is a widget for the iOS 14 home screen, powered by iTunes Store API.


  • iOS 14
  • Scriptable App Version 1.5 or newer
  • Parameter
    movie ID: Go to the iTunes Store and search for your favorite movie. On detail page press the share button and select copy link. Paste the link everywhere you want to get the id. At the end of the link you see the word id with different numbers. The numbers after the id is your movie ID.
    country: Your two digits country code, like "de" for Germany.
    quality: "sd" or "hd" for your favorite quality


  • Copy the code above
  • Go to Scriptable App and create a new script
  • Paste the code to the script
  • Save the script with pressing the done button
  • Go to your iOS home screen and press anywhere to enter "wiggle mode" (which also allows you to arrange the app icons)
  • Press the "+" symbol in the top left corner, then scroll down to "Scriptable", select the widget size you want and press "Add Widget" at the bottom
  • Press the widget to edit its settings (optionally press and hold if the wiggle mode is already closed)
  • Under "Script" select the one you created above
  • Enter the parameters like the following: movieID|country|quality (example: 991367195|de|hd)


It is a fun project developed by myself, not an official product of the iTunes Store. I have no relationship to iTunes Store and get neither commission.



Copy link

Leibinger015 commented Nov 15, 2020

The indicator of the promotion Wednesday film would be great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment