diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-06-17 10:24:55 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-06-17 10:24:55 +0200 |
commit | d0f54de4520990c8465bf2b78a1ce8c0161d46d7 (patch) | |
tree | 8416baf94f20bb81613e8195eccc20c9c35278e0 /plugins | |
parent | c1d0fe75d267f33724c38af95efc7b1c050dc160 (diff) |
Properly support youtube timestamp in url
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Page.hpp | 4 | ||||
-rw-r--r-- | plugins/Youtube.hpp | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/plugins/Page.hpp b/plugins/Page.hpp index 0ed4933..39222b1 100644 --- a/plugins/Page.hpp +++ b/plugins/Page.hpp @@ -112,8 +112,10 @@ namespace QuickMedia { virtual std::unique_ptr<RelatedVideosPage> create_related_videos_page(Program *program) = 0; // Return nullptr if the service doesn't support channels page virtual std::unique_ptr<Page> create_channels_page(Program *program, const std::string &channel_url) = 0; - void set_url(std::string new_url) { url = std::move(new_url); } + virtual void set_url(std::string new_url) { url = std::move(new_url); } std::string get_url() { return url; } + // Returns empty string for no timestamp or if the video doesn't support timestamps + virtual std::string get_url_timestamp() { return ""; } // Falls back to |get_url| if this and |get_audio_url| returns empty strings virtual std::string get_video_url(int max_height, bool &has_embedded_audio) { (void)max_height; diff --git a/plugins/Youtube.hpp b/plugins/Youtube.hpp index 28b50bb..d8c4cc2 100644 --- a/plugins/Youtube.hpp +++ b/plugins/Youtube.hpp @@ -132,13 +132,15 @@ namespace QuickMedia { class YoutubeVideoPage : public VideoPage { public: - YoutubeVideoPage(Program *program, std::string url) : VideoPage(program, std::move(url)) {} + YoutubeVideoPage(Program *program, std::string url); const char* get_title() const override { return ""; } BodyItems get_related_media(const std::string &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) override; std::unique_ptr<Page> create_channels_page(Program *program, const std::string &channel_url) override; + 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) override; std::string get_audio_url() override; PluginResult load(std::string &title, std::string &channel_url) override; @@ -147,6 +149,7 @@ namespace QuickMedia { void parse_format(const Json::Value &format_json, bool is_adaptive); void parse_formats(const Json::Value &streaming_data_json); private: + std::string timestamp; std::string xsrf_token; std::string comments_continuation_token; std::string hls_manifest_url; |