Closed ghost closed 3 years ago
Loop through the 'results' key of the search result
from jikanpy import Jikan
import urllib
import json
jikan = Jikan()
print("Input anime you want: ", end="")
search = input()
result = urllib.parse.quote(search)
search_result = jikan.search('anime', result,parameters={'limit': 4})
for dict_item in search_result["results"]:
print(dict_item["title"], dict_item["url"])
python3 test.py
Input anime you want: takagi
Karakai Jouzu no Takagi-san https://myanimelist.net/anime/35860/Karakai_Jouzu_no_Takagi-san
Karakai Jouzu no Takagi-san 2 https://myanimelist.net/anime/38993/Karakai_Jouzu_no_Takagi-san_2
Karakai Jouzu no Takagi-san: Water Slide https://myanimelist.net/anime/37621/Karakai_Jouzu_no_Takagi-san__Water_Slide
Touhai Densetsu Akagi: Yami ni Maiorita Tensai https://myanimelist.net/anime/658/Touhai_Densetsu_Akagi__Yami_ni_Maiorita_Tensai
Closing this, feel free to re-open if this doesnt solve your problem
Hey there. First of all. Thanks for your help. It working great. Now i have another problem. Let said i want to sort order of series. Example: This is log when i search Detective Conan series
Input anime you want: Conan
Mirai Shounen Conan https://myanimelist.net/anime/302/Mirai_Shounen_Conan
Detective Conan OVA 01: Conan vs. Kid vs. Yaiba https://myanimelist.net/anime/1369/Detective_Conan_OVA_01__Conan_vs_Kid_vs_Yaiba
Detective Conan https://myanimelist.net/anime/235/Detective_Conan
Detective Conan Movie 19: The Hellfire Sunflowers https://myanimelist.net/anime/28479/Detective_Conan_Movie_19__The_Hellfire_Sunflowers
Mirai Shounen Conan (Movie) https://myanimelist.net/anime/7308/Mirai_Shounen_Conan_Movie
Detective Conan Movie 13: The Raven Chaser https://myanimelist.net/anime/5460/Detective_Conan_Movie_13__The_Raven_Chaser
Detective Conan Movie 22: Zero the Enforcer https://myanimelist.net/anime/35798/Detective_Conan_Movie_22__Zero_the_Enforcer
Mirai Shounen Conan 2: Taiga Daibouken https://myanimelist.net/anime/2613/Mirai_Shounen_Conan_2__Taiga_Daibouken
Detective Conan OVA 04: Conan and Kid and Crystal Mother https://myanimelist.net/anime/2514/Detective_Conan_OVA_04__Conan_and_Kid_and_Crystal_Mother
Lupin III vs. Detective Conan https://myanimelist.net/anime/6115/Lupin_III_vs_Detective_Conan
Detective Conan OVA 03: Conan and Heiji and the Vanished Boy https://myanimelist.net/anime/2513/Detective_Conan_OVA_03__Conan_and_Heiji_and_the_Vanished_Boy
Detective Conan: Conan vs. Kid - Shark & Jewel https://myanimelist.net/anime/9785/Detective_Conan__Conan_vs_Kid_-_Shark___Jewel
Detective Conan vs. Wooo https://myanimelist.net/anime/10766/Detective_Conan_vs_Wooo
Detective Conan Movie 14: The Lost Ship in the Sky https://myanimelist.net/anime/6467/Detective_Conan_Movie_14__The_Lost_Ship_in_the_Sky
Detective Conan: Conan vs. Kid - Jet Black Sniper https://myanimelist.net/anime/9786/Detective_Conan__Conan_vs_Kid_-_Jet_Black_Sniper
Detective Conan OVA 10: Kid in Trap Island https://myanimelist.net/anime/8609/Detective_Conan_OVA_10__Kid_in_Trap_Island
Lupin III vs. Detective Conan: The Movie https://myanimelist.net/anime/18429/Lupin_III_vs_Detective_Conan__The_Movie
Detective Conan OVA 02: 16 Suspects https://myanimelist.net/anime/2512/Detective_Conan_OVA_02__16_Suspects
Detective Conan Movie 01: The Timed Skyscraper https://myanimelist.net/anime/779/Detective_Conan_Movie_01__The_Timed_Skyscraper
Detective Conan Movie 05: Countdown to Heaven https://myanimelist.net/anime/1364/Detective_Conan_Movie_05__Countdown_to_Heaven
You can see, there are no order. It possible to sort it from oldest to latest? Like Movie - Detective Conan Movie 01 -> Detective Conan Movie 02 - > Detective Conan Movie 03 and so on?
As far as I know the order of relations on myanimelist is arbitrary -- sometimes they're ordered in the 'correct' release order, sometimes in chronological
If you wanted to order it in release order, the only way to be sure would be to request each entry in the relation and grab its original release/air date, and then order it manually -- would be lots of requests but I dont think theres a way to be sure otherwise
Oh ok thanks for help me understand it ! kudo author. Have a good day ❤️ !
Hello . I was trying to pass though a loop of dict to get all title from result query... This is my latest code All i want to get is all title, url.
print(search_result[dict_item])