From 060db5c6cbd02e684a0c98c0f045da242b6ab218 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 9 Oct 2021 14:49:13 +0200 Subject: Add lbry, attempt to fix 4chan posting when captcha is no-op --- plugins/Lbry.hpp | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 plugins/Lbry.hpp (limited to 'plugins/Lbry.hpp') diff --git a/plugins/Lbry.hpp b/plugins/Lbry.hpp new file mode 100644 index 0000000..ac7c4b4 --- /dev/null +++ b/plugins/Lbry.hpp @@ -0,0 +1,53 @@ +#pragma once + +#include "Page.hpp" + +namespace QuickMedia { + class LbrySearchPage : public Page { + public: + LbrySearchPage(Program *program, std::string channel_id = "") : Page(program), channel_id(std::move(channel_id)) {} + const char* get_title() const override { return "Search"; } + bool search_is_filter() override { return false; } + SearchResult search(const std::string &str, BodyItems &result_items) override; + 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 &result_tabs) override; + bool submit_is_async() const override { return false; } + private: + std::string channel_id; + }; + + class LbryChannelPage : public LazyFetchPage { + public: + LbryChannelPage(Program *program, std::string title, std::string channel_id) : + LazyFetchPage(program), search_page(program, channel_id), title(std::move(title)), channel_id(std::move(channel_id)) {} + const char* get_title() const override { return title.c_str(); } + bool submit_is_async() const override { return false; } + bool search_is_filter() override { return false; } + SearchResult search(const std::string &str, BodyItems &result_items) override; + 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 &result_tabs) override; + PluginResult lazy_fetch(BodyItems &result_items) override; + private: + LbrySearchPage search_page; + std::string title; + std::string channel_id; + }; + + class LbryVideoPage : public VideoPage { + public: + LbryVideoPage(Program *program, std::string title, std::string url) : VideoPage(program, std::move(url)), title(std::move(title)) {} + const char* get_title() const override { return ""; } + //BodyItems get_related_media(const std::string &url) override; + //bool create_search_page(Program *program, Tab &tab) override; + std::unique_ptr create_comments_page(Program *program) override; + std::unique_ptr create_related_videos_page(Program *program) override; + std::unique_ptr create_channels_page(Program *program, const std::string &channel_url) override; + std::string get_download_url(int max_height) override; + std::string get_video_url(int max_height, bool &has_embedded_audio, std::string &ext) override; + std::string get_audio_url(std::string &ext) override; + PluginResult load(std::string &title, std::string &channel_url, std::vector &chapters, std::string &err_str) override; + private: + std::string title; + std::string streaming_url; + }; +} \ No newline at end of file -- cgit v1.2.3