Commit 42ca8f0b authored by Marc's avatar Marc
Browse files

fix 2021-12-31

parent dd0effb2
......@@ -1049,6 +1049,46 @@ _raw_data: Dict[Date, Tuple[LineToAdd, JeuToAdd, LineToDelete]] = {
(3, ("CHANSON", "Clandestino (Manu Chao)", "")),
], []
),
(2021, 12, 20): (
[], [
(0, ("", "", "")),
(1, ("", "", "")),
(2, ("", "", "")),
(3, ("", "", "")),
], []
),
(2021, 12, 21): (
[], [
(0, ("", "", "")),
(1, ("", "", "")),
(2, ("", "", "")),
(3, ("", "", "")),
], []
),
(2021, 12, 22): (
[], [
(0, ("", "", "")),
(1, ("", "", "")),
(2, ("", "", "")),
(3, ("", "", "")),
], []
),
(2021, 12, 23): (
[], [
(0, ("", "", "")),
(1, ("", "", "")),
(2, ("", "", "")),
(3, ("", "", "")),
], []
),
(2021, 12, 24): (
[], [
(0, ("", "", "")),
(1, ("", "", "")),
(2, ("", "", "")),
(3, ("", "", "")),
], []
),
}
data: Dict[datetime.date, Tuple[List[Tuple[int, str]], List[Tuple[int, Tuple[str, str, str]]], List[int]]] = {
......
......@@ -81,6 +81,8 @@ class ARParser(Parser):
return datetime.datetime.strptime(self._root.find(class_='h-label').string, 'Émission du %d %B %Y').date()
def intro(self) -> str:
if len(self._root.find_all(class_='lead')) == 0:
return ""
intro_parts = self._root.find_all(class_='lead')[0].contents
intro_para = ''.join([s.string if isinstance(s, bs4.element.NavigableString) else '\n' for s in intro_parts])
intro_para = intro_para.replace('\n\n', '\n')
......@@ -161,6 +163,8 @@ class ARParser(Parser):
@classmethod
def is_available(cls, date: datetime.date) -> bool:
if datetime.date(2021, 12, 13) <= date <= datetime.date(2021, 12, 17):
return False
if datetime.date(2020, 12, 14) <= date <= datetime.date(2020, 12, 18):
return False
if datetime.date(2019, 12, 16) <= date <= datetime.date(2019, 12, 20):
......
......@@ -35,9 +35,22 @@ class FRParser(ARParser):
2014,
2015,
2020,
2021,
]
return date in (datetime.date(year, 12, 31) for year in years) or datetime.date(2016, 12, 30) <= date <= datetime.date(2016, 12, 31)
def date(self) -> datetime.date:
h_label = self._root.find(class_='h-label')
if h_label is not None:
return datetime.datetime.strptime(h_label.string, 'Émission du %d %B %Y').date()
return datetime.datetime.strptime(self._root.find('h4').string, "L'intégrale de l'émission du %d %B %Y").date()
def image_link(self) -> str:
if self._root.img is not None:
return self._root.img['data-src']
return 'https://www.rts.ch/2017/06/12/13/48/8662580.image'
def best_of(self) -> bool:
return True
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment