expired domains scrapper python

Solutions on MaxInterview for expired domains scrapper python by the best coders in the world

showing results for - "expired domains scrapper python"
Randal
22 May 2019
1#all cats are yellow
2import requests,time
3from bs4 import BeautifulSoup
4
5url = "URL_HERE"
6r = requests.get(url)
7
8listy = []
9main_url = "https://www.expireddomains.net"
10while True:
11    try:
12        r = requests.get(url)
13        html = BeautifulSoup(r.text,"lxml")
14        url = main_url + html.find("div",class_="right").find("a")["href"]
15
16        print url
17        links = html.find_all(class_="field_domain")
18
19        for x in links:
20            listy.append(x.find("a")["title"])
21            print x.find("a")["title"]
22
23        r = requests.get(url)
24        print "Total Urls Found ", len(listy)
25    except:
26        print html
27        if html.text.__contains__("You hit the rate limiter. Slow down!"):
28            File = open("sites.txt", "w")
29            for x in listy:
30                File.write(x + "\n")
31            File.flush()
32            print "Total Urls Found ", len(listy)
33            print "Sleeping..."
34            time.sleep(5)
35
36
37        else:
38            print "Breaking"
39            break
40
41File = open("sites.txt","w")
42for x in listy:
43    File.write(x + "\n")
44File.close()