I'm trying to get only the keys' values that are exact to my 'title' query but the results seem to be anything that contains at least a part of the query which is very inexact. If I type "noragami", for example, I only want to get the results that have that word in them but that's not happening.
For example, if I search that, I get:
{
"Title": "Noragami OVA",
"Episodes": 2,
"Image": "https://cdn.myanimelist.net/images/anime/7/77177.jpg?s=189ec6d865ed53e2e5195ba05a632fff"
}
{
"Title": "Noragami Aragoto OVA",
"Episodes": 2,
"Image": "https://cdn.myanimelist.net/images/anime/11/77510.jpg?s=9e9261ac9140accd6844392db5d9a952"
}
{
"Title": "Noraneko",
"Episodes": 1,
"Image": "https://cdn.myanimelist.net/images/anime/2/88357.jpg?s=4df00538a268a9927f352d2b5718d934"
}
The last one shouldn't be there so how can I fix this?
This is the code for it:
search_params = {
'animes' : 'title',
'q' : request.POST['search']
}
r = requests.get(animes_url, params=search_params)
results = r.json()
results = results['results']
output = []
for result in results:
animes_data = {
'Title' : result["title"],
'Episodes' : result["episodes"],
'Image' : result["image_url"]
}
output.append(animes_data)
[print(json.dumps(item, indent=4)) for item in output]