aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-11-04 18:59:53 +0100
committerdec05eba <dec05eba@protonmail.com>2020-11-04 18:59:53 +0100
commit4e7b6ef98c5f31dbeed50050254e0cb70fe0d959 (patch)
tree834b76b1ef4046065061396a6fb724ca9d663244
parent096ee0c2670f176cfab76d54a440e5d9201d79b4 (diff)
Youtube: fix channels page after lazy fetch
-rw-r--r--src/plugins/Youtube.cpp24
1 files changed, 2 insertions, 22 deletions
diff --git a/src/plugins/Youtube.cpp b/src/plugins/Youtube.cpp
index 2418073..e04c51f 100644
--- a/src/plugins/Youtube.cpp
+++ b/src/plugins/Youtube.cpp
@@ -468,28 +468,8 @@ namespace QuickMedia {
PluginResult YoutubeSearchPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
if(strncmp(url.c_str(), "https://www.youtube.com/channel/", 32) == 0) {
- std::vector<CommandArg> additional_args = {
- { "-H", "x-spf-referer: " + url },
- { "-H", "x-youtube-client-name: 1" },
- { "-H", "x-spf-previous: " + url },
- { "-H", "x-youtube-client-version: 2.20200626.03.00" },
- { "-H", "referer: " + url }
- };
-
- //std::vector<CommandArg> cookies = get_cookies();
- //additional_args.insert(additional_args.end(), cookies.begin(), cookies.end());
-
- Json::Value json_root;
- DownloadResult result = download_json(json_root, url + "/videos?pbj=1", std::move(additional_args), true);
- if(result != DownloadResult::OK) return download_result_to_plugin_result(result);
-
- auto channel_body = create_body();
- std::unordered_set<std::string> added_videos;
- std::string continuation_token;
- channel_body->items = parse_channel_videos(json_root, continuation_token, added_videos);
- auto channel_page = std::make_unique<YoutubeChannelPage>(program, url, std::move(continuation_token), title);
- channel_page->added_videos = std::move(added_videos);
- result_tabs.push_back(Tab{std::move(channel_body), std::move(channel_page), create_search_bar("Search...", SEARCH_DELAY_FILTER)});
+ // TODO: Make all pages (for all services) lazy fetch in a similar manner!
+ result_tabs.push_back(Tab{create_body(), std::make_unique<YoutubeChannelPage>(program, url, "", title), create_search_bar("Search...", SEARCH_DELAY_FILTER)});
} else {
result_tabs.push_back(Tab{nullptr, std::make_unique<YoutubeVideoPage>(program), nullptr});
}