over in another thread (https://forum.inaturalist.org/t/creating-inaturalist-places-and-linking-to-wikidata-using-geojson/12220/15), @salgo60 talks about a tool that seems to pretty quickly return a Wikipedia URL based on an iNat place ID, if the place is set up with an iNat identifier in Wikidata. he wrote:
Correct would be to ask Wikipedia for the english article corresponding to the iNaturalist place id 152114 and as the Wikidata property is Property:P7471 then this hub tool can help
so then modifying this slightly for taxon, brown bear would be https://hub.toolforge.org/P3151:41641?lang=en
you could check out the tool to see exactly what it’s doing, or maybe it could just be used directly rather than trying to replicate its functionality.