@siracusa Not sure if this will be of use to you, but I have a Swift script that does exactly what you were describing in regards to getting the filenames of favorite photos in Photos.app.

I don’t even compile it, just swift <filename>.

https://gist.github.com/melonamin/5673f0b465ccbed54287574e49aba1e3

Script to get filenames of Favorite photos from Photos.app

Script to get filenames of Favorite photos from Photos.app - GetFavoritePhotos.swift

Gist