How to resolve blockchain dns using Python Requests

0 votes

There are certain blockchain domains that are resolved only by blockchain DNS resolvers. If you try to open this link in a browser, it won't get resolved.

But, just install the browser plugin from https://blockchain-dns.info/ and then try to open the site again, it will open up smoothly.

I want to scrape some data from this site using Python Requests (browserless) and have no idea how to resolve such blockchain domains. Any help would be highly appreciated.

Apr 5, 2022 in Blockchain by Rahul
• 9,670 points
309 views

1 answer to this question.

0 votes

BDNS is offline and I don't know if they'll be back. I searched for similar public HTTP APIs but couldn't find one that works well enough. Preferably, we can use Dnspython to query an OpenNIC server.

import dns.resolver import requests def domain_to_ip(domain, dns_server='159.89.120.99'): '''Uses an OpenNIC server to resolve blockchain domains :param domain: str Domain or URL :param dns_server: str Optional, OpenNIC server :raises dns.resolver.NXDOMAIN: if `dns_server` fails to resolve `domain` ''' if '://' in domain: domain = domain.split('/')[2] res = dns.resolver.Resolver() res.nameservers = [dns_server] answers = res.resolve(domain) return [rdata.address for rdata in answers] ips = domain_to_ip('http://track2.bazar') if ips: r = requests.get('https://'+ips[0], verify=False) print(r)

answered Apr 7, 2022 by Aditya
• 7,660 points

Related Questions In Blockchain

0 votes
1 answer

How to resolve blockchain DNS using Python Requests?

You could use one of their publicly ...READ MORE

answered Aug 20, 2018 in Blockchain by Omkar
• 69,190 points
1,389 views
0 votes
1 answer

How to resolve Blockchain DNS using Python Requests?

Look at this example: import requests from random import ...READ MORE

answered Aug 22, 2018 in Blockchain by Christine
• 15,790 points
871 views
+1 vote
1 answer
0 votes
1 answer

How to interact with blockchain using Java web app?

You can interact with the blockchain using ...READ MORE

answered Jul 16, 2018 in Blockchain by digger
• 26,740 points
732 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,198 views
0 votes
1 answer
0 votes
1 answer

On-Chain NFT: How to store a pixel image on the ethereum blockchain?

The images are usually not stored in ...READ MORE

answered Feb 24, 2022 in Blockchain by Aditya
• 7,660 points
525 views
0 votes
1 answer

How to get Bitcoin Private Key from an ExtPrivKey using NBitcoin

From what I see in the code ...READ MORE

answered Apr 7, 2022 in Blockchain by Aditya
• 7,660 points
684 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP