Scaling behavior in photoelectron spectra of Ce- and Yb-based heavy fermions