Skip to content

RanduSoft/RSAppStoreScraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RSAppStoreScraper

A lightweight, modern Swift library for scraping app icons and screenshots from the Apple App Store.

Features

  • 🚀 Asynchronous API: Uses modern Swift async/await for network calls.
  • 📦 Zero Dependencies: Pure Swift implementation using Foundation.
  • 📱 Multi-Platform Support: Extract assets for iPhone, iPad, Mac, Apple Watch, Apple TV, and Vision Pro.
  • 🛠️ Robust Parsing: Implements a dual parsing strategy—primary JSON data extraction with a regex-based DOM fallback.
  • 🖼️ Asset Metadata: Retrieves image URLs along with their native width and height.

Requirements

  • macOS 14.0+
  • iOS 16.0+
  • Swift 6.0+

Installation

Swift Package Manager

Add the following dependency to your Package.swift:

dependencies: [
    .package(url: "https://github.com/RanduSoft/RSAppStoreScraper.git", from: "1.1.0")
]

Or add it directly in Xcode via File > Add Packages.

Usage

import AppStoreScraper

let scraper = AppStoreScraper()

do {
    // Replace with a valid App Store ID
    let media = try await scraper.fetchMedia(forAppID: "1497748716")
    
    // Access the App Icon
    if let icon = media.icon {
        print("Icon URL: \(icon.url)")
    }
    
    // Access Screenshots by Platform
    for (platform, screenshots) in media.screenshots {
        print("--- \(platform.rawValue) ---")
        for screenshot in screenshots {
            print("Screenshot: \(screenshot.url) (\(screenshot.width)x\(screenshot.height))")
        }
    }
} catch {
    print("Failed to fetch media: \(error)")
}

How it Works

The library fetches the public App Store product page and attempts to:

  1. Locate and parse the serialized-server-data JSON script tag (most reliable).
  2. Fallback to parsing the HTML DOM using optimized Regular Expressions if the JSON structure is unavailable or changes.

Built with AI

Everything in this repository was built 100% by AI, using Google Gemini 3 Pro.

License

This project is available under the MIT License.