diff options
author | Alban Gruin | 2017-09-09 20:20:18 +0200 |
---|---|---|
committer | Alban Gruin | 2017-09-09 20:20:18 +0200 |
commit | 0dfb4fbf3478b0b07d0e6995b108974e6eb16d50 (patch) | |
tree | ea3c0c15e5f8d11f17aad433d4f4568ee8c291f2 | |
parent | 9ac263a081a831e61577502aa8c6fa131da96151 (diff) |
Génération du lien complet
-rw-r--r-- | management/commands/scraptimetables.py | 4 |
1 files changed, 3 insertions, 1 deletions
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) |