diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-04-30 04:05:26 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-04-30 04:05:26 +0200 |
commit | 575ccde5d1e896a279d58375704f4ace3f48bf6a (patch) | |
tree | 93618e0934bcbd7d9f83d9cb696df9945540543d /src/plugins | |
parent | 7dc7ee78094a3d76e8cb70d724a7054d59347369 (diff) |
Make initial youtube request faster (faster cookies setup)
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/Youtube.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
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<CommandArg> 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<CommandArg> additional_args = { |