diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Page.hpp | 1 | ||||
-rw-r--r-- | plugins/Youtube.hpp | 30 |
2 files changed, 31 insertions, 0 deletions
diff --git a/plugins/Page.hpp b/plugins/Page.hpp index e720f14..44526db 100644 --- a/plugins/Page.hpp +++ b/plugins/Page.hpp @@ -101,6 +101,7 @@ namespace QuickMedia { virtual PageTypez get_type() const override { return PageTypez::VIDEO; } virtual BodyItems get_related_media(const std::string &url, std::string &channel_url) { (void)url; (void)channel_url; return {}; } virtual std::unique_ptr<Page> create_search_page(Program *program, int &search_delay) { (void)program; (void)search_delay; return nullptr; } + virtual std::unique_ptr<Page> create_comments_page(Program *program) { (void)program; return nullptr; } // Return nullptr if the service doesn't support related videos page virtual std::unique_ptr<RelatedVideosPage> create_related_videos_page(Program *program, const std::string &video_url, const std::string &video_title) = 0; // Return nullptr if the service doesn't support channels page 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 |