aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/Youtube.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/plugins/Youtube.cpp b/src/plugins/Youtube.cpp
index ce7af0e..46128ec 100644
--- a/src/plugins/Youtube.cpp
+++ b/src/plugins/Youtube.cpp
@@ -91,8 +91,8 @@ namespace QuickMedia {
{ "-H", "referer: " + url }
};
- /*std::vector<CommandArg> cookies = get_cookies();
- additional_args.insert(additional_args.end(), cookies.begin(), cookies.end());*/
+ std::vector<CommandArg> cookies = get_cookies();
+ additional_args.insert(additional_args.end(), cookies.begin(), cookies.end());
std::string website_data;
if(download_to_string(url + "?pbj=1", website_data, additional_args, use_tor, true) != DownloadResult::OK)
@@ -285,8 +285,8 @@ namespace QuickMedia {
{ "-H", "referer: " + url }
};
- /*std::vector<CommandArg> cookies = get_cookies();
- additional_args.insert(additional_args.end(), cookies.begin(), cookies.end());*/
+ std::vector<CommandArg> cookies = get_cookies();
+ additional_args.insert(additional_args.end(), cookies.begin(), cookies.end());
std::string website_data;
if(download_to_string(url + "&pbj=1", website_data, additional_args, use_tor, true) != DownloadResult::OK)
@@ -365,8 +365,8 @@ namespace QuickMedia {
{ "-H", "referer: " + url }
};
- /*std::vector<CommandArg> cookies = get_cookies();
- additional_args.insert(additional_args.end(), cookies.begin(), cookies.end());*/
+ std::vector<CommandArg> cookies = get_cookies();
+ additional_args.insert(additional_args.end(), cookies.begin(), cookies.end());
std::string website_data;
if(download_to_string(next_url, website_data, additional_args, use_tor, true) != DownloadResult::OK)
@@ -409,6 +409,9 @@ namespace QuickMedia {
}
std::vector<CommandArg> Youtube::get_cookies() const {
+ if(use_tor)
+ return {};
+
Path cookies_filepath;
if(get_cookies_filepath(cookies_filepath, name) != 0) {
fprintf(stderr, "Warning: Failed to create youtube cookies file\n");
@@ -477,8 +480,8 @@ namespace QuickMedia {
{ "-H", "referer: " + url }
};
- /*std::vector<CommandArg> cookies = get_cookies();
- additional_args.insert(additional_args.end(), cookies.begin(), cookies.end());*/
+ std::vector<CommandArg> cookies = get_cookies();
+ additional_args.insert(additional_args.end(), cookies.begin(), cookies.end());
std::string website_data;
if(download_to_string(modified_url + "&pbj=1", website_data, additional_args, use_tor, true) != DownloadResult::OK)
@@ -546,10 +549,6 @@ namespace QuickMedia {
if(!content_item_json.isObject())
continue;
- const Json::Value &compact_video_renderer_json = content_item_json["compactVideoRenderer"];
- if(!compact_video_renderer_json.isObject())
- continue;
-
auto body_item = parse_compact_video_renderer_json(content_item_json, added_videos);
if(body_item)
result_items.push_back(std::move(body_item));