diff options
author | dec05eba <dec05eba@protonmail.com> | 2022-08-09 20:05:48 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2022-08-09 20:24:43 +0200 |
commit | 809141aae58b6aaa70c07d845392d6ced86c3eb0 (patch) | |
tree | f7ac01d0dbbddab554f2f0b87d2d511a546dd289 /src | |
parent | b5dd15aedfbd619e7780b9357c35c429fe5c377c (diff) |
Manganelo: fix search
Fix old mangakakalot links, such as evil heart
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/MangaCombined.cpp | 3 | ||||
-rw-r--r-- | src/plugins/Manganelo.cpp | 15 |
2 files changed, 17 insertions, 1 deletions
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<BodyItems>([&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) }; |