From 809141aae58b6aaa70c07d845392d6ced86c3eb0 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 9 Aug 2022 20:05:48 +0200 Subject: Manganelo: fix search Fix old mangakakalot links, such as evil heart --- src/plugins/MangaCombined.cpp | 3 +++ src/plugins/Manganelo.cpp | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'src/plugins') diff --git a/src/plugins/MangaCombined.cpp b/src/plugins/MangaCombined.cpp index fca5705..ce08b1c 100644 --- a/src/plugins/MangaCombined.cpp +++ b/src/plugins/MangaCombined.cpp @@ -93,6 +93,9 @@ namespace QuickMedia { SearchResult MangaCombinedSearchPage::search(const std::string &str, BodyItems &result_items) { search_threads.clear(); + if(str.empty()) + return SearchResult::OK; + for(auto &search_page : search_pages) { search_threads.push_back(std::make_pair(&search_page, AsyncTask([&str, &search_page]() { BodyItems search_page_body_items; diff --git a/src/plugins/Manganelo.cpp b/src/plugins/Manganelo.cpp index 8186155..5a75d5d 100644 --- a/src/plugins/Manganelo.cpp +++ b/src/plugins/Manganelo.cpp @@ -116,6 +116,19 @@ namespace QuickMedia { return 0; }, &chapters_items); + result = quickmedia_html_find_nodes_xpath(&html_search, "//div[class='chapter-list']//a", + [](QuickMediaMatchNode *node, void *userdata) { + auto *item_data = (BodyItems*)userdata; + QuickMediaStringView href = quickmedia_html_node_get_attribute_value(node, "href"); + QuickMediaStringView text = quickmedia_html_node_get_text(node); + if(href.data && text.data) { + auto item = BodyItem::create(std::string(text.data, text.size)); + item->url.assign(href.data, href.size); + item_data->push_back(std::move(item)); + } + return 0; + }, &chapters_items); + BodyItemContext body_item_context; body_item_context.body_items = &chapters_items; body_item_context.index = 0; @@ -167,7 +180,7 @@ namespace QuickMedia { } SearchResult ManganeloSearchPage::search(const std::string &str, BodyItems &result_items) { - std::string url = "https://manganelo.com/getstorysearchjson"; + std::string url = "https://manganato.com/getstorysearchjson"; std::string search_term = "searchword="; search_term += url_param_encode(str); CommandArg data_arg = { "--data-raw", std::move(search_term) }; -- cgit v1.2.3