On récupère les dates de la C3C, mais pas l'heure...

This commit is contained in:
Jean-Marie Favreau 2024-09-04 22:23:45 +02:00
parent 1c812a3d65
commit ff681ed93a
3 changed files with 11 additions and 3 deletions

View File

@ -28,7 +28,7 @@ from src.agenda_culturel.import_tasks.custom_extractors import *
if __name__ == "__main__":
u2e = URL2Events(SimpleDownloader(), c3c.CExtractor())
u2e = URL2Events(ChromiumHeadlessDownloader(), c3c.CExtractor())
url = "https://billetterie-c3c.clermont-ferrand.fr/"
url_human = "https://billetterie-c3c.clermont-ferrand.fr/"

View File

@ -64,6 +64,7 @@ class CExtractor(TwoStepsExtractor):
tags.append(tag)
# TODO: parser les dates, récupérer les heures ()
dates = [self.parse_french_date(o.get("value")) for o in soup.select("select.datedleb_resa option")]

View File

@ -65,8 +65,15 @@ class Extractor(ABC):
month = self.guess_month(m.group(2))
year = m.group(3)
else:
# TODO: consolider les cas non satisfaits
return None
# format Numero Mois Annee
m = re.search("([0-9]+)/([0-9]+)/([0-9]+)", text)
if m:
day = m.group(1)
month = int(m.group(2))
year = m.group(3)
else:
# TODO: consolider les cas non satisfaits
return None
if month is None:
return None