From ada70b65e7dcead733c5357597e51efdea769545 Mon Sep 17 00:00:00 2001 From: dece Date: Tue, 16 Mar 2021 00:46:07 +0100 Subject: [PATCH] get-definitions: avoid ambiguity loops --- get-definitions.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/get-definitions.py b/get-definitions.py index b2ac47c..da1e56d 100644 --- a/get-definitions.py +++ b/get-definitions.py @@ -10,6 +10,7 @@ from requests import models BASE_URL = "https://www.cnrtl.fr/definition/" +CRIMINAL_SCUM = [] def main(): @@ -59,10 +60,11 @@ def get_definitions(form): if h2: title = str(h2.string).strip() if title == "Terme introuvable": + CRIMINAL_SCUM.append(form) links = contentbox("a") for link in links: alternative_form = str(link.string).strip() - if alternative_form == form: + if alternative_form in CRIMINAL_SCUM: continue get_definitions(alternative_form) elif title == "Erreur":