How to sort all the papers referenced by a given paper by citation count? Here is what I want to do:

Given a paper, find the set of all papers referenced by it
Sort this set of papers by some &quot;importance metric,&quot;  for example, the citation count.

I find some ad-hoc tools (for example, research gate) to do #1 and there are a few databases (Web of Science, Scopus) to do #2, but the two steps are disconnected and there seems no easy way to bridge them automatically. I have been doing this manually, but it is very tedious.
Are there any efficient ways to do this?
Thanks
Microsoft Academic provides an option to sort references of a paper by citation count. I am not aware how complete or accurate it is, but you could try it out. They also seem to provide an API for automated access.
Screenshot of an example for reference:

Note: I am not affiliated with this service.