Small suggestion: instead of hardcoding the .se domain, you might want to send a request to Wikidata to get the currently ised domains. That's how similar sci-hub tools do it to stay up-to-date.
I had never heard of wikidata, but might steal this idea for a similar app I have on F-Droid that pulls PDFs from Sci-Hub when a doi link is clicked using android's intent system https://f-droid.org/en/packages/com.sigmarelax.doitoscihub/
Is Wikidata the proper way to get the currently functioning mirror? I was under the impression that you had to get it from Elbakyan's VK or the SciHub Telegram. I've been assuming that the subreddit would update with accurate links, so I've just been scraping it from there: https://github.com/smasher164/search/blob/53ae11b52f158d1986...
My god, why did you mention wikidata? SPARQL is the most obscure fucking thing I've ever encountered. I've been sitting here for an hour trying to find how to get the data of a specific page!
I made an iOS Shortcut based on the same code. To use it after installing, access it from the iOS Share screen when you're on a relevant site. It will look for preferred mirrors from Wikidata before running.