From 3e55199544908a8026b4fe621b2b6af7770ce4a4 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 12 Nov 2021 23:53:29 +0100 Subject: Add youtube description --- plugins/Youtube.hpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'plugins') diff --git a/plugins/Youtube.hpp b/plugins/Youtube.hpp index 23f7e20..d3a57a6 100644 --- a/plugins/Youtube.hpp +++ b/plugins/Youtube.hpp @@ -23,6 +23,14 @@ namespace QuickMedia { YoutubeFormat base; }; + struct YoutubeVideoDetails { + std::string title; + std::string author; + std::string rating; + std::string views; + std::string description; + }; + // Returns |url| if the url is already a youtube url std::string invidious_url_to_youtube_url(const std::string &url); bool youtube_url_extract_id(const std::string &youtube_url, std::string &youtube_video_id); @@ -52,6 +60,12 @@ namespace QuickMedia { std::unordered_set added_videos; }; + class YoutubeDescriptionPage : public Page { + public: + YoutubeDescriptionPage(Program *program) : Page(program) {} + const char* get_title() const override { return "Description"; } + }; + class YoutubeCommentsPage : public LazyFetchPage { public: YoutubeCommentsPage(Program *program, const std::string &video_url, const std::string &continuation_token) : LazyFetchPage(program), video_url(video_url), continuation_token(continuation_token) {} @@ -144,6 +158,7 @@ namespace QuickMedia { const char* get_title() const override { return ""; } BodyItems get_related_media(const std::string &url) override; PluginResult get_related_pages(const BodyItems &related_videos, const std::string &channel_url, std::vector &result_tabs) override; + int get_related_pages_first_tab() override { return 1; } void set_url(std::string new_url) override; std::string get_url_timestamp() override { return timestamp; } std::string get_video_url(int max_height, bool &has_embedded_audio, std::string &ext) override; @@ -166,5 +181,6 @@ namespace QuickMedia { std::string playback_url; std::string watchtime_url; std::string tracking_url; + YoutubeVideoDetails video_details; }; } -- cgit v1.2.3