Compare commits

...

5 Commits

1 changed files with 15 additions and 8 deletions

View File

@ -27,6 +27,9 @@ def get_films_by_reference(viewings):
if keyword.startswith("a-"):
keyword = keyword[2:]
if keyword.endswith("-character"):
keyword = keyword[:-10]
referenced = keyword.replace("-", " ")
try:
@ -41,6 +44,7 @@ def get_films_by_reference(viewings):
page_title = page_title[0].upper() + page_title[1:]
page_url = VCinemaUtils.generate_wikipedia_url(page_title)
except wikipedia.PageError as _:
if len(searches) > 0:
try:
referenced_page = wikipedia.page(title=searches[0], auto_suggest=False)
@ -50,6 +54,9 @@ def get_films_by_reference(viewings):
page_title = e.title
page_title = page_title[0].upper() + page_title[1:]
page_url = VCinemaUtils.generate_wikipedia_url(page_title)
else:
page_title = referenced.title()
page_url = None
if page_title in films_by_reference.keys():
films_by_reference[page_title]["keywords"].append(keyword)