This commit is contained in:
Sarah 2022-12-09 20:25:19 +00:00
parent 0f59b2cd67
commit 9c1e4caf68
1 changed files with 7 additions and 5 deletions

View File

@ -21,10 +21,12 @@ def get_films_by_reference(viewings):
films_by_reference[reference]["films"].append(viewing) films_by_reference[reference]["films"].append(viewing)
break break
else: else:
referenced = keyword[13:].replace("-", " ") keyword = keyword[13:]
if referenced.startswith("a "): if keyword.startswith("a-"):
referenced = referenced[2:] keyword = keyword[2:]
referenced = keyword.replace("-", " ")
try: try:
searches = wikipedia.search(referenced, suggestion=False) searches = wikipedia.search(referenced, suggestion=False)
@ -63,11 +65,11 @@ def update_page(token_id, token_secret, films_by_reference_keyword):
def build_page(films_by_reference): def build_page(films_by_reference):
films_by_reference_sorted = OrderedDict(sorted(films_by_reference.items(), key=lambda t: t[0])) films_by_reference = OrderedDict(sorted(films_by_reference.items(), key=lambda t: t[0]))
table = "| Referenced | Films |\n| - | - |" table = "| Referenced | Films |\n| - | - |"
for reference, referenced in films_by_reference_sorted.items(): for reference, referenced in films_by_reference.items():
table += "\n" table += "\n"
row_data = [] row_data = []