-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
66 lines (58 loc) · 2.41 KB
/
main.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
61
62
63
64
65
66
from bs4 import BeautifulSoup
from selenium import webdriver
from openpyxl import load_workbook
import datetime
theDate = str(datetime.date.today())
driver = webdriver.Chrome(executable_path=r'c:\Users\DELL\Desktop\chromedriver.exe')
driver.get('https://www.check4d.com/')
magnumResults = []
damacaiResults = []
totoResults = []
magnumResults.append(theDate)
damacaiResults.append(theDate)
totoResults.append(theDate)
content = driver.page_source
soup = BeautifulSoup(content, 'html.parser')
for element in soup.findAll(attrs={'id': 'magnum4d'}):
for element1 in element.findAll(attrs={'class': 'resultTable2'}):
for fst in element1.findAll(attrs={'class': 'resulttop'}):
magnumResults.append(fst.text)
for element2 in element.findAll(attrs={'class': 'resultTable2'}):
for sAndC in element2.findAll(attrs={'class': 'resultbottom'}):
if sAndC.text == '----':
continue
else:
magnumResults.append(sAndC.text)
for element in soup.findAll(attrs={'id': 'damacai'}):
for element1 in element.findAll(attrs={'class': 'resultTable2'}):
for fst in element1.findAll(attrs={'class': 'resulttop'}):
damacaiResults.append(fst.text)
for element2 in element.findAll(attrs={'class': 'resultTable2'}):
for sAndC in element2.findAll(attrs={'class': 'resultbottom'}):
damacaiResults.append(sAndC.text)
damacaiResults.pop(14)
for element in soup.findAll(attrs={'id': 'sportstoto'}):
for element1 in element.findAll(attrs={'class': 'resultTable2'}):
for fst in element1.findAll(attrs={'class': 'resulttop'}):
totoResults.append(fst.text)
for element2 in element.findAll(attrs={'class': 'resultTable2'}):
for sAndC in element2.findAll(attrs={'class': 'resultbottom'}):
if sAndC.text == '****':
continue
else:
totoResults.append(sAndC.text)
for i in range(1, len(magnumResults)):
magnumResults[i] = int(magnumResults[i])
for i in range(1, len(damacaiResults)):
damacaiResults[i] = int(damacaiResults[i])
for i in range(1, len(totoResults)):
totoResults[i] = int(totoResults[i])
wb = load_workbook('MaPiao.xlsx')
m = wb['Magnum']
d = wb['DaMaCai']
t = wb['ToTo']
m.append(magnumResults)
d.append(damacaiResults)
t.append(totoResults)
wb.save('MaPiao.xlsx')
driver.close()