tweaselORG / parse-tunes

Library for fetching select data on iOS apps from the Apple App Store via undocumented internal iTunes APIs.
MIT License
10 stars 1 forks source link

List of genres (categories) on iTunes/the App Store #3

Closed baltpeter closed 1 year ago

baltpeter commented 1 year ago

We need a list of all the possible categories (Apple internally calls them "genres") on the App Store.

baltpeter commented 1 year ago

This one's easy: https://itunes.apple.com/WebObjects/MZStoreServices.woa/ws/genres has a full list.

We are interested in first-level category 36 (App Store). The grab a list of all second-level subcategories (there are also third-level categories but only for "Games", "Magazines & Newspapers", "Stickers") :

const genreJson = await fetch('https://itunes.apple.com/WebObjects/MZStoreServices.woa/ws/genres').then((r) =>
    r.json()
);

const appsGenres = genreJson[36];
if (appsGenres.name !== 'App Store') throw new Error('Unexpected API response.');

const subgenres = Object.values(appsGenres.subgenres).reduce((acc, cur) => ({ ...acc, [cur.name]: +cur.id }), {});
subgenres.all = 36;
console.log(subgenres);

That yields:

{
  "Business": 6000,
  "Weather": 6001,
  "Utilities": 6002,
  "Travel": 6003,
  "Sports": 6004,
  "Social Networking": 6005,
  "Reference": 6006,
  "Productivity": 6007,
  "Photo & Video": 6008,
  "News": 6009,
  "Navigation": 6010,
  "Music": 6011,
  "Lifestyle": 6012,
  "Health & Fitness": 6013,
  "Games": 6014,
  "Finance": 6015,
  "Entertainment": 6016,
  "Education": 6017,
  "Books": 6018,
  "Medical": 6020,
  "Magazines & Newspapers": 6021,
  "Catalogs": 6022,
  "Food & Drink": 6023,
  "Shopping": 6024,
  "Stickers": 6025,
  "Developer Tools": 6026,
  "Graphics & Design": 6027,
  "all": 36
}