Skip to content

Instantly share code, notes, and snippets.

@ghandic
Created May 8, 2018 10:58
Show Gist options
  • Save ghandic/e082c46b36ce8084a40f79244b5d0dba to your computer and use it in GitHub Desktop.
Save ghandic/e082c46b36ce8084a40f79244b5d0dba to your computer and use it in GitHub Desktop.
Finds all available custom app url strings, for example if you paste and run this github link in your browser x-github-client://openRepo/https://github.com/ghandic/facial_analysis_api
import plistlib
import glob
import json
import os
app_urls=[]
for app in glob.glob('/Applications/*.app'):
urls=[]
for pl in glob.glob(os.path.join(app, 'contents/Info.plist')):
try:
plist = plistlib.readPlist(pl)
for urltype in plist.get('CFBundleURLTypes'):
for scheme in urltype.get('CFBundleURLSchemes'):
urls.append(scheme)
except:
pass
if len(urls) > 0:
app_urls.append({app.replace('/Applications/', '').replace('.app', ''):urls})
print(json.dumps(app_urls, indent=2))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment