diff options
author | dec05eba <dec05eba@protonmail.com> | 2023-01-03 15:37:52 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2023-01-03 15:37:52 +0100 |
commit | 1f40fdb1f23797347a960aaa53f3656a4fe5f44f (patch) | |
tree | be04d64f5c3a26936625ac03d59800f449dc9434 /src/plugins | |
parent | 1b4cad6e46e4486afbaf895505685cbec8cc981f (diff) |
Manganelo: fix search
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/Manganelo.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/plugins/Manganelo.cpp b/src/plugins/Manganelo.cpp index ef7f52c..777a4b4 100644 --- a/src/plugins/Manganelo.cpp +++ b/src/plugins/Manganelo.cpp @@ -180,6 +180,9 @@ namespace QuickMedia { } SearchResult ManganeloSearchPage::search(const std::string &str, BodyItems &result_items) { + if(str.empty()) + return SearchResult::OK; + std::string url = "https://manganato.com/getstorysearchjson"; std::string search_term = "searchword="; search_term += url_param_encode(str); @@ -192,10 +195,14 @@ namespace QuickMedia { if(json_root.isNull()) return SearchResult::OK; - if(!json_root.isArray()) + if(!json_root.isObject()) + return SearchResult::ERR; + + const Json::Value &searchlist_json = json_root["searchlist"]; + if(!searchlist_json.isArray()) return SearchResult::ERR; - for(const Json::Value &child : json_root) { + for(const Json::Value &child : searchlist_json) { if(!child.isObject()) continue; |