Digikey itself does a bit of this. So does Mouser, and it's a main feature of octopart.
Go to any part and there is both a short list of aka or substitute part numbers and a few links to likely alternatives.
The links aren't always good sibstitutions. Sometimes they are, but sometimes they are only very general alternatives where it does the same nominal job but you'd have to change your design to use the other part, sometimes they are merely related or associated in any sort of way like on Amazon. Maybe it's the mate to the connector you're looking at or the pin that fits in a housing, maybe it's an alternative, maybe it's just frequently ordered together for who knows what reason.
But if there's an aka list, that will be mostly a good drop-in substitution list.
Go for say a max3232-alike from anyone, and the aka list will have several good drop-in replacements from different manufacturers with totally different looking part numbers.
You still have to vet them yourself because some might be the wrong voltage or package. And you definitely have to check whatever fine details you care about like if you're trying to go for lowest possible power usage or highest possible temperature range, the substitutions will include everything not just the ones with the same lowest possible idle current that's a few uA less than usual like the one you had picked out.
They obviously have an extensive db in house with columns for all kinds of propeties, and some code to make meaningful matches and substitutions where there are sensible subsets of properties being considered vs ignored.
I think it would be totally abusive to their site to write something that scrapes it, or octopart etc.
There would have to be a community built db like that. The code for finding intelligent matches probably wouldn't be too crazy. A list of which properties are significant for a given part would just be part of the data on that part, and then it's pretty straight query on that.
A ui in a find-subs tool could even let you select/unselect properties for consideration, since what constitutes "significant" changes for each job. Sometimes even different package sizes are ok with you because for a lot of parts it's possible to draw a single footprint that can accomodate multiple different versions of the part.
But even with something like this, most jobs are doable an almost infinite number of ways using whatever parts you have access to. If you don't have one resistor anywhere in the world, you can use 2 others in parrallel, etc. The same job got done with no 1:1 substitution at all.
To be really useful there would need to be something quite a bit more involved. Where you would have to feed in your whole schematic so the the tool would know that this resistor isn't just a resistor, but the bias input to a transistor, and if you need change the transistor and you can't find a simple exact match you can find some other transistor AND a different bias input together to produce the same outward effect as the previous 2-part block. Let's just say "non-trivial"