-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParsingZumi.py
More file actions
49 lines (42 loc) · 1.28 KB
/
ParsingZumi.py
File metadata and controls
49 lines (42 loc) · 1.28 KB
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
import requests
from bs4 import BeautifulSoup
class ZumiParser:
@staticmethod
def getTempAddres(NIP):
try:
req = 'http://www.zumi.pl/namapie.html?query=' + NIP
r = requests.get(req)
data = r.text
soup = BeautifulSoup(data)
x = soup.find_all(id="searchList")[0]
x = x.find_all(class_="link")[0]
x = x['href']
except:
return False
return x
@staticmethod
def getNumber(tempAddress):
try:
req = 'http://www.zumi.pl'+tempAddress
r = requests.get(req)
soup = BeautifulSoup(r.text)
x = soup.find_all("span", class_="phoneFull")[0]
x = x.find_all("a")[0]
return x.get_text()
except:
return "-"
@staticmethod
def getMail(tempAddress):
try:
req = 'http://www.zumi.pl'+tempAddress
r = requests.get(req)
soup = BeautifulSoup(r.text)
x = soup.find_all(id="teleDataBox")[0]
x = x.find_all("a")[2]
return x.get_text()
except:
return "-"
if __name__ == "__main__":
x = ZumiParser.getTempAddres("9271821297")
print(ZumiParser.getNumber(x))
print(ZumiParser.getMail(x))