Okay, I had a quick look at a dumb (scraping-based) answer to this, but gave up. So this answer is more of an idea of what not to do, or what to take further.
Given you're already using Python, you could have gone one step further and scraped that page with BeautifulSoup. (pip install beautifulsoup4
)
However, Etherscan is protected by Cloudflare, so you can't just scrape the page directly.
What you can do is use a package such as Cloudscraper. (pip install cloudscraper -U
)
However, the page you're looking at is also dynamically generated, so you can't just scrape the HTML.
What you can do is use a browser driver such as Selenium to programatically create the page and grab the data. (pip install selenium
)
But then... it'd probably be quicker to find an appropriate API! (Caution: I've noticed different chain explorers will index tokens slightly differently, as well as use different sources for prices. You're unlikely to find a different explorer with exactly the same overall price as Etherscan.)