aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Page.hpp1
-rw-r--r--plugins/Youtube.hpp19
2 files changed, 20 insertions, 0 deletions
diff --git a/plugins/Page.hpp b/plugins/Page.hpp
index db11a61..5f5af60 100644
--- a/plugins/Page.hpp
+++ b/plugins/Page.hpp
@@ -34,6 +34,7 @@ namespace QuickMedia {
// Note: the first page is 0
virtual PluginResult get_page(const std::string &str, int page, BodyItems &result_items) { (void)str; (void)page; (void)result_items; return PluginResult::OK; }
+ // TODO: Move to a subclass called VideoPage
virtual BodyItems get_related_media(const std::string &url);
DownloadResult download_json(Json::Value &result, const std::string &url, std::vector<CommandArg> additional_args, bool use_browser_useragent = false, std::string *err_msg = nullptr);
diff --git a/plugins/Youtube.hpp b/plugins/Youtube.hpp
index bdb9c8b..e2dd201 100644
--- a/plugins/Youtube.hpp
+++ b/plugins/Youtube.hpp
@@ -1,6 +1,7 @@
#pragma once
#include "Page.hpp"
+#include <unordered_set>
namespace QuickMedia {
class YoutubeSearchPage : public Page {
@@ -17,6 +18,24 @@ namespace QuickMedia {
std::string search_url;
std::string continuation_token;
int current_page = 0;
+ std::unordered_set<std::string> added_videos;
+ };
+
+ class YoutubeChannelPage : public Page {
+ public:
+ YoutubeChannelPage(Program *program, std::string url, std::string continuation_token, std::string title) : Page(program), url(std::move(url)), continuation_token(std::move(continuation_token)), title(std::move(title)) {}
+ const char* get_title() const override { return title.c_str(); }
+ 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<Tab> &result_tabs) override;
+
+ std::unordered_set<std::string> added_videos;
+ private:
+ PluginResult search_get_continuation(const std::string &url, const std::string &continuation_token, BodyItems &result_items);
+ private:
+ const std::string url;
+ std::string continuation_token;
+ const std::string title;
+ int current_page = 0;
};
class YoutubeVideoPage : public Page {