forked from green93000/green93000
-
Notifications
You must be signed in to change notification settings - Fork 0
/
r_matchs (1).py
78 lines (68 loc) · 2.53 KB
/
r_matchs (1).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
67
68
69
70
71
72
73
74
75
76
77
78
from urllib.request import urlopen as uopen
from bs4 import BeautifulSoup
import re
#import pandas as pd
def resMatch():
output = []
my_url = uopen('https://www.matchendirect.fr/espagne')
html_p = my_url.read()
my_url.close()
soup = BeautifulSoup(html_p, "html.parser")
container = soup.findAll("div", {"id":"livescore"})
for c in container:
team_c = c.findAll("td", {"class":"lm3"})
for x in team_c:
team = x.a["title"]
regex_team = re.findall(r'[^Détail du match \:].*', team)
score_c = x.findAll("span", {"class":"lm3_score"})
score = score_c[0].text
output.append("".join(regex_team))
return output
# print("MATCH:" + "\t" + team)
# print("SCORE:" + "\t" + score)
print(resMatch())
def score():
output_score = []
my_url2 = uopen('https://www.matchendirect.fr/espagne')
html_p2 = my_url2.read()
my_url2.close()
soup2 = BeautifulSoup(html_p2, "html.parser")
container_score = soup2.findAll("div", {"id":"livescore"})
for con in container_score:
team_con = con.findAll("td", {"class":"lm3"})
for x in team_con:
score_c = x.findAll("span", {"class":"lm3_score"})
score = score_c[0].text
output_score.append(score)
return output_score
#print(score())
def statut():
output_statut = []
my_url3 = uopen('https://www.matchendirect.fr/espagne')
html_p3 = my_url3.read()
my_url3.close()
soup3 = BeautifulSoup(html_p3, "html.parser")
container_statut = soup3.findAll("div", {"id":"livescore"})
for cont in container_statut:
team_cont = cont.findAll("td", {"class":"lm2 lm2_0"})
for x in team_cont:
statut_c = x.span.decompose()
statut = x.text
output_statut.append(statut)
return output_statut
#print(statut())
def horaire():
output_horaire = []
my_url3 = uopen('https://www.matchendirect.fr/espagne')
html_p3 = my_url3.read()
my_url3.close()
soup3 = BeautifulSoup(html_p3, "html.parser")
container_statut = soup3.findAll("div", {"id":"livescore"})
for cont in container_statut:
team_cont = cont.findAll("td", {"class":"lm2 lm2_0"})
for x in team_cont:
horaire = x.next_element.text.strip("-- : --")
output_horaire.append(horaire)
# print(output_horaire)
return output_horaire
#print(horaire())