-
Notifications
You must be signed in to change notification settings - Fork 0
/
Leadify.py
60 lines (50 loc) · 2.76 KB
/
Leadify.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import requests
from bs4 import BeautifulSoup
import sys
import random, time
colors = [36, 32, 34, 35, 31, 37]
clear = '\x1b[0m'
logo = '''
-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-
██╗░░░░░ ███████╗ ░█████╗░ ██████╗░ ██╗ ███████╗ ██╗░░░██╗
██║░░░░░ ██╔════╝ ██╔══██╗ ██╔══██╗ ██║ ██╔════╝ ╚██╗░██╔╝
██║░░░░░ █████╗░░ ███████║ ██║░░██║ ██║ █████╗░░ ░╚████╔╝░
██║░░░░░ ██╔══╝░░ ██╔══██║ ██║░░██║ ██║ ██╔══╝░░ ░░╚██╔╝░░
███████╗ ███████╗ ██║░░██║ ██████╔╝ ██║ ██║░░░░░ ░░░██║░░░
╚══════╝ ╚══════╝ ╚═╝░░╚═╝ ╚═════╝░ ╚═╝ ╚═╝░░░░░ ░░░╚═╝░░░
-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-
'''
for N, line in enumerate(logo.split('\n')):
sys.stdout.write(' \x1b[1;%dm%s%s\n ' % (random.choice(colors), line, clear))
time.sleep(0.06)
def GetNums(link):
page = requests.get(link)
soup = BeautifulSoup(page.content, 'html.parser')
products = soup.select('div.info')
print("Found!!")
print("-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-")
for product in products:
reviews = product.select('div.phone')[0].text
print(reviews)
with open('Numbers Scrapped.txt', 'a+') as outFile:
writer = outFile.writelines("\n" + reviews)
def rmDups():
linesSeen = set()
with open("Numbers Scrapped.txt", 'r+') as f:
d = f.readlines()
f.seek(0)
for unique in d:
if unique not in linesSeen:
f.write(unique)
linesSeen.add(unique)
f.truncate()
usrInput = input("[+] Which profession people to search for : ")
city = input("[+] Enter Target city : ")
print("==> Searching.....")
print("-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-҉҉-")
for i in range(11):
link = "https://www.yellowpages.com/search?search_terms=" + usrInput + "&geo_location_terms=" + city + "&page=" + str(i)
extract = GetNums(link)
dupsRmvd = rmDups()
print("Done Extracting! :)")
input("Enter any key to exit!")