diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-05-06 08:18:38 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-05-06 08:18:38 +0200 |
commit | e66d24f74d5458241d869fb3df42b4f2a2ea69f4 (patch) | |
tree | 760d09d7626cf1a7cb2845c0133a125a944344a2 /plugins | |
parent | 12b352c31c0821ba8bd667a4ed17e1d5406fcdf6 (diff) |
Show youtube recommendations instead of local recommendations from related videos
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Page.hpp | 1 | ||||
-rw-r--r-- | plugins/Youtube.hpp | 20 |
2 files changed, 21 insertions, 0 deletions
diff --git a/plugins/Page.hpp b/plugins/Page.hpp index 175b44b..426469a 100644 --- a/plugins/Page.hpp +++ b/plugins/Page.hpp @@ -90,6 +90,7 @@ namespace QuickMedia { virtual PluginResult lazy_fetch(BodyItems &result_items) = 0; // If this returns true then |lazy_fetch| is not meant to return results but async background load the page. This can be used to fetch API keys for example virtual bool lazy_fetch_is_loader() { return false; } + virtual bool reload_on_page_change() { return false; } }; class RelatedVideosPage : public Page { diff --git a/plugins/Youtube.hpp b/plugins/Youtube.hpp index dc3f0e7..746619c 100644 --- a/plugins/Youtube.hpp +++ b/plugins/Youtube.hpp @@ -86,6 +86,22 @@ namespace QuickMedia { std::array<AsyncTask<std::vector<YoutubeSubscriptionTaskResult>>, 4> subscription_load_tasks; // TODO: Use multiple curl outputs instead? }; + class YoutubeRecommendedPage : public LazyFetchPage { + public: + YoutubeRecommendedPage(Program *program) : LazyFetchPage(program) {} + const char* get_title() const override { return "Recommended"; } + 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; + bool reload_on_page_change() override { return true; } + private: + PluginResult search_get_continuation(const std::string &continuation_token, BodyItems &result_items); + private: + int current_page = 0; + std::string continuation_token; + std::unordered_set<std::string> added_videos; + }; + class YoutubeRelatedVideosPage : public RelatedVideosPage { public: YoutubeRelatedVideosPage(Program *program) : RelatedVideosPage(program) {} @@ -106,5 +122,9 @@ namespace QuickMedia { std::string xsrf_token; std::string comments_continuation_token; std::string url; + + std::string playback_url; + std::string watchtime_url; + std::string tracking_url; }; }
\ No newline at end of file |