aboutsummaryrefslogtreecommitdiff
path: root/plugins/Youtube.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Youtube.hpp')
-rw-r--r--plugins/Youtube.hpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/plugins/Youtube.hpp b/plugins/Youtube.hpp
index c0bb429..f8a5d5f 100644
--- a/plugins/Youtube.hpp
+++ b/plugins/Youtube.hpp
@@ -21,6 +21,32 @@ namespace QuickMedia {
std::unordered_set<std::string> added_videos;
};
+ class YoutubeCommentsPage : public LazyFetchPage {
+ public:
+ YoutubeCommentsPage(Program *program, const std::string &xsrf_token, const std::string &continuation_token) : LazyFetchPage(program), xsrf_token(xsrf_token), continuation_token(continuation_token) {}
+ const char* get_title() const override { return "Comments"; }
+ 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;
+ PluginResult lazy_fetch(BodyItems &result_items) override;
+ private:
+ int current_page = 0;
+ std::string xsrf_token;
+ std::string continuation_token;
+ };
+
+ class YoutubeCommentRepliesPage : public LazyFetchPage {
+ public:
+ YoutubeCommentRepliesPage(Program *program, const std::string &xsrf_token, const std::string &continuation_token) : LazyFetchPage(program), xsrf_token(xsrf_token), continuation_token(continuation_token) {}
+ const char* get_title() const override { return "Comment replies"; }
+ 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;
+ PluginResult lazy_fetch(BodyItems &result_items) override;
+ private:
+ int current_page = 0;
+ std::string xsrf_token;
+ std::string continuation_token;
+ };
+
class YoutubeChannelPage : public LazyFetchPage {
public:
YoutubeChannelPage(Program *program, std::string url, std::string continuation_token, std::string title) : LazyFetchPage(program), url(std::move(url)), continuation_token(std::move(continuation_token)), title(std::move(title)) {}
@@ -53,7 +79,11 @@ namespace QuickMedia {
const char* get_title() const override { return ""; }
BodyItems get_related_media(const std::string &url, std::string &channel_url) override;
std::unique_ptr<Page> create_search_page(Program *program, int &search_delay) override;
+ std::unique_ptr<Page> create_comments_page(Program *program) override;
std::unique_ptr<RelatedVideosPage> create_related_videos_page(Program *program, const std::string &video_url, const std::string &video_title) override;
std::unique_ptr<LazyFetchPage> create_channels_page(Program *program, const std::string &channel_url) override;
+ private:
+ std::string xsrf_token;
+ std::string comments_continuation_token;
};
} \ No newline at end of file