1
0
Fork 0

Add support for multiple Steam games of the exact same title. Fixes for example "Wolfenstein II: The New Colossus" having both international and german version under the same name.

This commit is contained in:
Casper V. Kristensen 2018-08-25 19:28:42 +02:00
parent 42b8b65de9
commit a42ad64994
Signed by: caspervk
GPG key ID: B1156723DB3BDDA8

View file

@ -60,8 +60,10 @@ class Steam(object):
payload = { payload = {
"term": query "term": query
} }
items = {i["name"]: i for i in self.cache.get("https://store.steampowered.com/api/storesearch", # Reverse results to make the first one take precedence over later ones if multiple results have the same name.
params=payload).json()["items"]} # E.g. "Wolfenstein II: The New Colossus" has both international and german version under the same name.
items = {i["name"]: i for i in reversed(self.cache.get("https://store.steampowered.com/api/storesearch",
params=payload).json()["items"])}
best_match = util.case_insensitive_close_matches(query, items, n=1, cutoff=0.90) best_match = util.case_insensitive_close_matches(query, items, n=1, cutoff=0.90)