Skip to content

Instantly share code, notes, and snippets.

@alastairmccormack
Created July 25, 2017 21:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alastairmccormack/8197a678eaaf802252f9e7e7bfe87bdc to your computer and use it in GitHub Desktop.
Save alastairmccormack/8197a678eaaf802252f9e7e7bfe87bdc to your computer and use it in GitHub Desktop.
Get "where from" information in macOS / OS X for a file
import xattr
import plistlib
x = xattr.xattr('mydownloaded.file')
where_from_plist = x['com.apple.metadata:kMDItemWhereFroms']
where_from = plistlib.loads(where_from_plist)
# list object of URLs. Presumably right most is original URL and left most is the redirected location(s)
print(where_from)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment