Created
December 3, 2019 19:58
-
-
Save anmolj7/f97f0413cfe665a0f56be0e54b22731a to your computer and use it in GitHub Desktop.
I first tried with requests and bs4 but it didn't work, the captcha came, so, instead, I had to use mechanize to browse the url, I mean, I could've used mechanize to fill out the form, and then, parse html, but why bother when you can just do this?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mechanize | |
from bs4 import BeautifulSoup | |
name = input("Enter the name you wanna search for: ").replace(" ", "+") | |
br = mechanize.Browser() | |
br.addheaders = [("User-agent","Mozilla/5.0")] | |
resp = br.open("https://viewdns.info/reversewhois/?q={}".format(name)) | |
soup = BeautifulSoup(resp.read(), "lxml") | |
soup = soup.find("table", attrs={'id':'null'}) | |
soup = soup.find('table') | |
print("The following mached the records: ") | |
for x in soup.findAll('tr'): | |
print(x.find('td').text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment