aboutsummaryrefslogtreecommitdiff
path: root/plugins/Youtube.hpp
blob: 007f3985621a5b02f6a44850e5a86280a5e98a7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#pragma once

#include "Page.hpp"

namespace QuickMedia {
    class YoutubeSearchPage : public Page {
    public:
        YoutubeSearchPage(Program *program) : Page(program) {}
        const char* get_title() const override { return "All"; }
        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<Tab> &result_tabs) override;
    private:
        PluginResult search_get_continuation(const std::string &url, const std::string &continuation_token, BodyItems &result_items);
    private:
        std::string search_url;
        std::string continuation_token;
        int current_page = 0;
    };

    class YoutubeVideoPage : public Page {
    public:
        YoutubeVideoPage(Program *program) : Page(program) {}
        const char* get_title() const override { return ""; }
        PluginResult submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) override {
            (void)title;
            (void)url;
            (void)result_tabs;
            return PluginResult::ERR;
        }
        BodyItems get_related_media(const std::string &url) override;
        bool is_video_page() const override { return true; }
    };
}