From ab5065e541cb6f84b11062892ce25f033c7fa82d Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 3 May 2021 01:48:19 +0200 Subject: Add readm.org --- plugins/MangaGeneric.hpp | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) (limited to 'plugins/MangaGeneric.hpp') diff --git a/plugins/MangaGeneric.hpp b/plugins/MangaGeneric.hpp index e313c97..dcd3544 100644 --- a/plugins/MangaGeneric.hpp +++ b/plugins/MangaGeneric.hpp @@ -4,13 +4,25 @@ #include namespace QuickMedia { + struct MangaFormData { + const char *key; + const char *value; + }; + + struct MangaFormDataStr { + const char *key; + std::string value; + }; + + using SearchQueryJsonHandler = std::function; struct SearchQuery { const char *search_template = nullptr; int page_start = 0; + std::vector form_data; + bool is_post = false; + SearchQueryJsonHandler json_handler = nullptr; }; - // If |url_contains| is null, then any matching query is added. If |title_field| is "text", then the inner text is used. - // If |url_field| is null, then the current page is used instead. struct TextQuery { const char *html_query = nullptr; const char *title_field = nullptr; @@ -98,44 +110,29 @@ namespace QuickMedia { const char* get_title() const override { return "Search"; } bool search_is_filter() override { return false; } SearchResult search(const std::string &str, BodyItems &result_items) override; - PluginResult get_page(const std::string &url, BodyItems &result_items); + PluginResult get_page(const std::string &url, bool is_post, const std::vector &form_data, BodyItems &result_items); PluginResult get_page(const std::string &str, int page, BodyItems &result_items) override; PluginResult submit(const std::string &title, const std::string &url, std::vector &result_tabs) override; sf::Vector2i get_thumbnail_max_size() override { return sf::Vector2i(101, 141); }; - // Add a %s where the search query should be inserted into |search_template| and add a %p where the page number should be inserted, for example: - // example.com/search?q=%s&page=%p - // This is required. MangaGenericSearchPage& search_handler(const char *search_template, int page_start); - // This is required. + MangaGenericSearchPage& search_post_handler(const char *url, std::vector form_data, SearchQueryJsonHandler result_handler); MangaGenericSearchPage& text_handler(std::vector queries); - // This is optional. MangaGenericSearchPage& description_handler(std::vector queries); - // This is optional. MangaGenericSearchPage& thumbnail_handler(std::vector queries); - // This is optional. MangaGenericSearchPage& authors_handler(std::vector queries); - // If |url_contains| is null, then any matching query is added. If |title_field| is "text", then the inner text is used. - // This is required. + MangaGenericSearchPage& list_chapters_handler(const char *html_query, const char *title_field, const char *url_field, const char *url_contains); - // If |field_contains| is null, then any matching query is added. If |field_name| is "text", then the inner text is used. - // This is optional. MangaGenericSearchPage& list_chapters_uploaded_time_handler(const char *html_query, const char *field_name, const char *field_contains); - // If |field_contains| is null, then any matching query is added. If |field_name| is "text", then the inner text is used. - // This or |list_page_images_pagination_handler| or |list_page_images_custom_handler| is required. MangaGenericSearchPage& list_page_images_handler(const char *html_query, const char *field_name, const char *field_contains, ListPageImagesQueryPost post_handler = nullptr); - // If |image_field_contains| is null, then any matching query is added. If |pages_field_name| or |image_field_name| is "text", then the inner text is used. - // The last matching pages html query item is chosen as the number of pages. - // This or |list_page_images_handler| or |list_page_images_custom_handler| is required. MangaGenericSearchPage& list_page_images_pagination_handler( const char *pages_html_query, const char *pages_field_name, const char *image_html_query, const char *image_field_name, const char *image_field_contains, const char *next_page_html_query, const char *next_page_field_name, const char *next_page_field_contains); - // This or |list_page_images_handler| or |list_page_images_pagination_handler| is required. MangaGenericSearchPage& list_page_images_custom_handler(ListPageCustomHandler handler); // For example: mangasite.com/manga/204353&f=23 -- cgit v1.2.3