That's what SteamSpy does and it extrapolates from there. It's why games with the section_type = ownersonly flag don't have ownership data (e.g. Underworld Ascendant's playtest app for alpha backers) as said flag limits the public exposure of said games, including their presence on user profiles -- they appear neither as recently played nor among a user's games list.
My mistake. I was thinking of the old way of using bots to trawl through each individual profile webpage instead of using the api, but my knowledge on this subject is very limited, so I am not sure if there is much difference between one and the other. Just that Valve, at least if my memory serves me, much preferred the latter to the former.