From 0dfb4fbf3478b0b07d0e6995b108974e6eb16d50 Mon Sep 17 00:00:00 2001 From: Alban Gruin Date: Sat, 9 Sep 2017 20:20:18 +0200 Subject: Génération du lien complet --- management/commands/scraptimetables.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/management/commands/scraptimetables.py b/management/commands/scraptimetables.py index da8899c..780ea8d 100644 --- a/management/commands/scraptimetables.py +++ b/management/commands/scraptimetables.py @@ -32,7 +32,9 @@ class Command(BaseCommand): soup = get_xml(finder) for link in soup.find_all("a"): if "toutes sections et semestres confondus" in link.text: - print(year, name, link.text, link.parent.parent.find("a", attrs={"class": "xmllink"})["href"]) + url_base = finder.rsplit("/", 1) + timetable_url = "/".join([url_base[0], link.parent.parent.find("a", attrs={"class": "xmllink"})["href"]]) + print(year, name, link.text, timetable_url) def __get_finders(self, url): soup = get_xml(url) -- cgit v1.2.1