From 575ccde5d1e896a279d58375704f4ace3f48bf6a Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 30 Apr 2021 04:05:26 +0200 Subject: Make initial youtube request faster (faster cookies setup) --- src/plugins/Youtube.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/Youtube.cpp b/src/plugins/Youtube.cpp index d03105c..993c861 100644 --- a/src/plugins/Youtube.cpp +++ b/src/plugins/Youtube.cpp @@ -343,15 +343,9 @@ namespace QuickMedia { cookies_filepath = filename; atexit(remove_cookies_file_at_exit); - std::vector additional_args = { - CommandArg{ "-b", cookies_filepath }, - CommandArg{ "-c", cookies_filepath } - }; - // TODO: Is there any way to bypass this? this is needed to set VISITOR_INFO1_LIVE which is required to read comments - std::string website_data; - DownloadResult result = download_to_string("https://youtube.com/subscription_manager?disable_polymer=1", website_data, std::move(additional_args), true); - if(result != DownloadResult::OK) + const char *args[] = { "curl", "-I", "-s", "-b", cookies_filepath.c_str(), "-c", cookies_filepath.c_str(), "https://www.youtube.com/subscription_manager?disable_polymer=1", nullptr }; + if(exec_program(args, nullptr, nullptr) != 0) fprintf(stderr, "Failed to fetch cookies to view youtube comments\n"); } @@ -525,7 +519,7 @@ namespace QuickMedia { current_page = 0; added_videos.clear(); - search_url = "https://youtube.com/results?search_query="; + search_url = "https://www.youtube.com/results?search_query="; search_url += url_param_encode(str); std::vector additional_args = { -- cgit v1.2.3