Strip initials from koreader authors

This commit is contained in:
2023-03-27 01:33:30 -04:00
parent ee01ffa4ad
commit cb0c00a695
2 changed files with 4 additions and 6 deletions

View File

@ -1,6 +1,5 @@
import json
import logging
import re
import urllib
import requests
@ -79,8 +78,6 @@ def lookup_book_from_openlibrary(title: str, author: str = None) -> dict:
title_quoted = urllib.parse.quote(title)
author_quoted = ""
if author:
# Strip middle initials, OpenLibrary often fails with these
author = re.sub(" [A-Z]. ", " ", author)
author_quoted = urllib.parse.quote(author)
query = f"{title_quoted} {author_quoted}"