on filtre les événements debrif de la comédie qui ne nous intéressent pas

Voir #216
This commit is contained in:
Jean-Marie Favreau 2024-11-27 11:39:51 +01:00
parent 555bae8dc8
commit d7ec80ff01

View File

@ -9,6 +9,12 @@ class CExtractor(TwoStepsExtractor):
nom_lieu = "La Comédie de Clermont"
url_referer = "https://lacomediedeclermont.com/saison24-25/"
def is_to_import_from_url(self, url):
if "on-debriefe" in url:
return False
else:
return True
def category_comedie2agenda(self, category):
mapping = {
"Théâtre": "Spectacles",
@ -50,33 +56,35 @@ class CExtractor(TwoStepsExtractor):
e_url = (
e.select("a")[0]["href"] + "#" + d
) # a "fake" url specific for each day of this show
self.add_event_url(e_url)
self.add_event_start_day(e_url, d)
t = (
str(e.select("div#datecal")[0])
.split(" ")[-1]
.split("<")[0]
)
self.add_event_start_time(e_url, t)
title = e.select("a")[0].contents[0]
self.add_event_title(e_url, title)
category = e.select("div#lieuevtcal span")
if len(category) > 0:
category, tag = self.category_comedie2agenda(
category[-1].contents[0]
if self.is_to_import_from_url(e_url):
self.add_event_url(e_url)
self.add_event_start_day(e_url, d)
t = (
str(e.select("div#datecal")[0])
.split(" ")[-1]
.split("<")[0]
)
if category:
self.add_event_category(e_url, category)
if tag:
self.add_event_tag(e_url, tag)
location = (
e.select("div#lieuevtcal")[0]
.contents[-1]
.split("")[-1]
)
if location.replace(" ", "") == "":
location = self.nom_lieu
self.add_event_location(e_url, location)
self.add_event_start_time(e_url, t)
title = e.select("a")[0].contents[0]
self.add_event_title(e_url, title)
category = e.select("div#lieuevtcal span")
if len(category) > 0:
category, tag = self.category_comedie2agenda(
category[-1].contents[0]
)
if category:
self.add_event_category(e_url, category)
if tag:
self.add_event_tag(e_url, tag)
location = (
e.select("div#lieuevtcal")[0]
.contents[-1]
.split("")[-1]
)
if location.replace(" ", "") == "":
location = self.nom_lieu
self.add_event_location(e_url, location)
def add_event_from_content(
self,