get-definitions: avoid ambiguity loops
This commit is contained in:
parent
5fb2c37142
commit
ada70b65e7
|
@ -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":
|
||||
|
|
Loading…
Reference in a new issue