How to resolve Blockchain DNS using Python Requests

0 votes

I want to scrap some data from this site:  https://blockchain-dns.info/ using Python Requests (browserless) and have no idea as to how to resolve such blockchain domains. Any help would be highly appreciated.

Aug 22, 2018 in Blockchain by sabby
• 4,390 points
1,150 views

1 answer to this question.

0 votes

Look at this example:

import requests
from random import choice

def domain_ip(domain):
    '''Uses bdns api to resolve domain names'''
    domain = domain.split('/')[2] if '://' in domain else domain
    apis = ['https://bdns.co/r/', 'https://bdns.us/r/', 'https://bdns.bz/r/']
    api = choice(apis)
    r = requests.get(api+domain)
    if r.status_code == 200:
        ip = r.text.splitlines()[0]
        print("Domain: {}  IP: {}".format(domain, ip))
        return ip
    else:
        print('HTTP Error: {}'.format(r.status_code))

ip = domain_ip('http://jstash.bazar')
if ip:
    r = requests.get('http://'+ip)

You could use one of their publicly available apis to resolve the domain and obtain an ip. Here is a list of API URLs: https://github.com/B-DNS/Firefox/blob/master/common.js#L54

answered Aug 22, 2018 by Christine
• 15,790 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,210 points
1,640 views
0 votes
1 answer

How to resolve blockchain dns using Python Requests

BDNS is offline and I don't know if ...READ MORE

answered Apr 7, 2022 in Blockchain by Aditya
• 7,680 points
650 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
922 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,697 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,235 views
0 votes
1 answer
0 votes
1 answer

How to make sure transactions take no fee in a private Ethereum blockchain?

In a private ethereum network you have ...READ MORE

answered Mar 26, 2018 in Blockchain by Christine
• 15,790 points

edited Mar 26, 2018 by Christine 1,364 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