aboutsummaryrefslogtreecommitdiff
path: root/plugins/Youtube.hpp
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-10-11 21:35:37 +0200
committerdec05eba <dec05eba@protonmail.com>2020-10-13 13:13:01 +0200
commit77ed51898157d99112be7550471ec06e32344c9e (patch)
tree0645274d0f13b4fa6940d4054f74a070611a8ef0 /plugins/Youtube.hpp
parentda89ec98fb34757f0c46dc8cb2dd87ae78d317ce (diff)
Refactor plugin into seperate pages
TODO: Readd 4chan login page, manganelo creators page, autocomplete
Diffstat (limited to 'plugins/Youtube.hpp')
-rw-r--r--plugins/Youtube.hpp36
1 files changed, 21 insertions, 15 deletions
diff --git a/plugins/Youtube.hpp b/plugins/Youtube.hpp
index 685d4b0..0922b9d 100644
--- a/plugins/Youtube.hpp
+++ b/plugins/Youtube.hpp
@@ -1,24 +1,30 @@
#pragma once
-#include "Plugin.hpp"
+#include "Page.hpp"
namespace QuickMedia {
- class Youtube : public Plugin {
+ class YoutubeSearchPage : public Page {
public:
- Youtube();
- PluginResult get_front_page(BodyItems &result_items) override;
- SuggestionResult update_search_suggestions(const std::string &text, BodyItems &result_items) override;
- BodyItems get_related_media(const std::string &url) override;
- bool search_suggestions_has_thumbnails() const override { return true; }
- bool search_results_has_thumbnails() const override { return false; }
- std::string autocomplete_search(const std::string &query) override;
- int get_search_delay() const override { return 350; }
- bool search_suggestion_is_search() const override { return true; }
- Page get_page_after_search() const override { return Page::VIDEO_CONTENT; }
+ YoutubeSearchPage(Program *program) : Page(program) {}
+ const char* get_title() const override { return "All"; }
+ bool search_is_filter() override { return false; }
+ SearchResult search(const std::string &str, BodyItems &result_items) override;
+ PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override;
private:
void search_suggestions_get_continuation(const std::string &url, const std::string &continuation_token, BodyItems &result_items);
- std::vector<CommandArg> get_cookies() const;
- private:
- std::string last_autocomplete_result;
+ };
+
+ class YoutubeVideoPage : public Page {
+ public:
+ YoutubeVideoPage(Program *program) : Page(program) {}
+ const char* get_title() const override { return ""; }
+ PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override {
+ (void)title;
+ (void)url;
+ (void)result_tabs;
+ return PluginResult::ERR;
+ }
+ BodyItems get_related_media(const std::string &url) override;
+ bool is_video_page() const override { return true; }
};
} \ No newline at end of file