aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/AsyncImageLoader.cpp6
-rw-r--r--src/Body.cpp11
-rw-r--r--src/DownloadUtils.cpp16
-rw-r--r--src/GoogleCaptcha.cpp12
-rw-r--r--src/Json.cpp4
-rw-r--r--src/QuickMedia.cpp43
-rw-r--r--src/VideoPlayer.cpp7
-rw-r--r--src/plugins/Fourchan.cpp2
-rw-r--r--src/plugins/Mangadex.cpp6
-rw-r--r--src/plugins/Manganelo.cpp12
-rw-r--r--src/plugins/Mangatown.cpp14
-rw-r--r--src/plugins/Matrix.cpp48
-rw-r--r--src/plugins/NyaaSi.cpp12
-rw-r--r--src/plugins/Page.cpp6
-rw-r--r--src/plugins/Pornhub.cpp10
15 files changed, 93 insertions, 116 deletions
diff --git a/src/AsyncImageLoader.cpp b/src/AsyncImageLoader.cpp
index c096e31..b5a61ae 100644
--- a/src/AsyncImageLoader.cpp
+++ b/src/AsyncImageLoader.cpp
@@ -102,7 +102,7 @@ namespace QuickMedia {
}
}
- void AsyncImageLoader::load_thumbnail(const std::string &url, bool local, sf::Vector2i resize_target_size, bool use_tor, std::shared_ptr<ThumbnailData> thumbnail_data) {
+ void AsyncImageLoader::load_thumbnail(const std::string &url, bool local, sf::Vector2i resize_target_size, std::shared_ptr<ThumbnailData> thumbnail_data) {
if(thumbnail_data->loading_state != LoadingState::NOT_LOADED)
return;
@@ -135,7 +135,7 @@ namespace QuickMedia {
download_image_thread[free_index].join();
// TODO: Keep the thread running and use conditional variable instead to sleep until a new image should be loaded. Same in ImageViewer.
- download_image_thread[free_index] = std::thread([this, free_index, thumbnail_path, url, local, resize_target_size, thumbnail_data, use_tor]() mutable {
+ download_image_thread[free_index] = std::thread([this, free_index, thumbnail_path, url, local, resize_target_size, thumbnail_data]() mutable {
thumbnail_data->image = std::make_unique<sf::Image>();
Path thumbnail_path_resized = thumbnail_path;
@@ -149,7 +149,7 @@ namespace QuickMedia {
return;
}
- if(!local && get_file_type(thumbnail_path.data) != FileType::REGULAR && download_to_file(url, thumbnail_path.data, {}, use_tor, true) != DownloadResult::OK) {
+ if(!local && get_file_type(thumbnail_path.data) != FileType::REGULAR && download_to_file(url, thumbnail_path.data, {}, true) != DownloadResult::OK) {
thumbnail_data->loading_state = LoadingState::FINISHED_LOADING;
loading_image[free_index] = false;
return;
diff --git a/src/Body.cpp b/src/Body.cpp
index 7133fbe..ced71fa 100644
--- a/src/Body.cpp
+++ b/src/Body.cpp
@@ -569,7 +569,9 @@ namespace QuickMedia {
prev_selected_item = selected_item;
}
- const bool merge_with_previous = body_item_merge_handler && body_item_merge_handler(get_previous_visible_item(selected_item), items[selected_item].get());
+ bool merge_with_previous = false;
+
+ merge_with_previous = body_item_merge_handler && body_item_merge_handler(get_previous_visible_item(selected_item), items[selected_item].get());
selected_item_height = get_item_height(items[selected_item].get(), size.x, true, true, merge_with_previous);
selected_item_height += spacing_y;
bool selected_item_fits_on_screen = selected_item_height <= size.y;
@@ -672,6 +674,7 @@ namespace QuickMedia {
BodyItem *prev_body_item = get_previous_visible_item(selected_item);
float prev_item_height = 0.0f;
+ merge_with_previous = false;
sf::Vector2f after_pos = pos;
for(int i = selected_item; i < num_items; ++i) {
@@ -681,7 +684,7 @@ namespace QuickMedia {
if(!item->visible)
continue;
- const bool merge_with_previous = body_item_merge_handler && body_item_merge_handler(prev_body_item, item.get());
+ merge_with_previous = body_item_merge_handler && body_item_merge_handler(prev_body_item, item.get());
if(merge_with_previous)
after_pos.y -= spacing_y;
@@ -736,7 +739,7 @@ namespace QuickMedia {
if(last_fully_visible_item == -1)
last_fully_visible_item = selected_item;
- offset_to_bottom = size.y - (after_pos.y - start_y);
+ offset_to_bottom = size.y - (after_pos.y - start_y - (last_item_fully_visible && merge_with_previous ? spacing_y : 0.0f));
if(!last_item_fully_visible_set)
last_item_fully_visible = true;
@@ -1149,7 +1152,7 @@ namespace QuickMedia {
item_thumbnail->referenced = true;
if(!item->thumbnail_url.empty() && item_thumbnail->loading_state == LoadingState::NOT_LOADED)
- AsyncImageLoader::get_instance().load_thumbnail(item->thumbnail_url, item->thumbnail_is_local, content_size, program->is_tor_enabled(), item_thumbnail);
+ AsyncImageLoader::get_instance().load_thumbnail(item->thumbnail_url, item->thumbnail_is_local, content_size, item_thumbnail);
if(item_thumbnail->loading_state == LoadingState::FINISHED_LOADING && item_thumbnail->image->getSize().x > 0 && item_thumbnail->image->getSize().y > 0) {
if(!item_thumbnail->texture.loadFromImage(*item_thumbnail->image))
diff --git a/src/DownloadUtils.cpp b/src/DownloadUtils.cpp
index 33b2830..e1c628c 100644
--- a/src/DownloadUtils.cpp
+++ b/src/DownloadUtils.cpp
@@ -20,11 +20,9 @@ static const char *useragent_str = "user-agent: Mozilla/5.0 (X11; Linux x86_64)
namespace QuickMedia {
// TODO: Add timeout
- DownloadResult download_to_string(const std::string &url, std::string &result, const std::vector<CommandArg> &additional_args, bool use_tor, bool use_browser_useragent, bool fail_on_error) {
+ DownloadResult download_to_string(const std::string &url, std::string &result, const std::vector<CommandArg> &additional_args, bool use_browser_useragent, bool fail_on_error) {
sf::Clock timer;
std::vector<const char*> args;
- if(use_tor)
- args.push_back("torsocks");
args.insert(args.end(), { "curl", "-H", "Accept-Language: en-US,en;q=0.5", "-H", "Connection: keep-alive", "--compressed", "-s", "-L" });
if(fail_on_error)
args.push_back("-f");
@@ -52,7 +50,7 @@ namespace QuickMedia {
return DownloadResult::OK;
}
- DownloadResult download_to_string_cache(const std::string &url, std::string &result, const std::vector<CommandArg> &additional_args, bool use_tor, bool use_browser_useragent, DownloadErrorHandler error_handler, Path cache_path) {
+ DownloadResult download_to_string_cache(const std::string &url, std::string &result, const std::vector<CommandArg> &additional_args, bool use_browser_useragent, DownloadErrorHandler error_handler, Path cache_path) {
Path media_dir;
Path media_file_path;
if(cache_path.data.empty()) {
@@ -71,7 +69,7 @@ namespace QuickMedia {
return DownloadResult::ERR;
}
} else {
- DownloadResult download_result = download_to_string(url, result, additional_args, use_tor, use_browser_useragent, error_handler ? false : true);
+ DownloadResult download_result = download_to_string(url, result, additional_args, use_browser_useragent, error_handler ? false : true);
if(download_result == DownloadResult::OK && error_handler)
download_result = error_handler(result) ? DownloadResult::OK : DownloadResult::ERR;
if(download_result == DownloadResult::OK) {
@@ -90,7 +88,7 @@ namespace QuickMedia {
}
// TODO: Use this everywhere we want to save to file (such as manga download)
- DownloadResult download_to_file(const std::string &url, const std::string &destination_filepath, const std::vector<CommandArg> &additional_args, bool use_tor, bool use_browser_useragent) {
+ DownloadResult download_to_file(const std::string &url, const std::string &destination_filepath, const std::vector<CommandArg> &additional_args, bool use_browser_useragent) {
Path tmp_filepath = destination_filepath;
tmp_filepath.append(".tmp");
@@ -103,7 +101,7 @@ namespace QuickMedia {
args.push_back({ "-o", tmp_filepath.data.c_str() });
std::string dummy;
- DownloadResult res = download_to_string(url, dummy, std::move(args), use_tor, use_browser_useragent);
+ DownloadResult res = download_to_string(url, dummy, std::move(args), use_browser_useragent);
if(res != DownloadResult::OK) return res;
if(rename(tmp_filepath.data.c_str(), destination_filepath.c_str()) != 0) {
@@ -115,11 +113,9 @@ namespace QuickMedia {
}
// TODO: Add timeout
- DownloadResult download_to_json(const std::string &url, rapidjson::Document &result, const std::vector<CommandArg> &additional_args, bool use_tor, bool use_browser_useragent, bool fail_on_error) {
+ DownloadResult download_to_json(const std::string &url, rapidjson::Document &result, const std::vector<CommandArg> &additional_args, bool use_browser_useragent, bool fail_on_error) {
sf::Clock timer;
std::vector<const char*> args;
- if(use_tor)
- args.push_back("torsocks");
args.insert(args.end(), { "curl", "-H", "Accept-Language: en-US,en;q=0.5", "-H", "Connection: keep-alive", "--compressed", "-s", "-L" });
if(fail_on_error)
args.push_back("-f");
diff --git a/src/GoogleCaptcha.cpp b/src/GoogleCaptcha.cpp
index b5c3e3c..3bd91eb 100644
--- a/src/GoogleCaptcha.cpp
+++ b/src/GoogleCaptcha.cpp
@@ -99,14 +99,14 @@ namespace QuickMedia {
return strip_html_tags(html_source.substr(start_index, end_index - start_index));
}
- std::future<bool> google_captcha_request_challenge(const std::string &api_key, const std::string &referer, RequestChallengeResponse challenge_response_callback, bool use_tor) {
- return std::async(std::launch::async, [challenge_response_callback, api_key, referer, use_tor]() {
+ std::future<bool> google_captcha_request_challenge(const std::string &api_key, const std::string &referer, RequestChallengeResponse challenge_response_callback) {
+ return std::async(std::launch::async, [challenge_response_callback, api_key, referer]() {
std::string captcha_url = "https://www.google.com/recaptcha/api/fallback?k=" + api_key;
std::string response;
std::vector<CommandArg> additional_args = {
CommandArg{"-H", "Referer: " + referer}
};
- DownloadResult download_result = download_to_string(captcha_url, response, additional_args, use_tor);
+ DownloadResult download_result = download_to_string(captcha_url, response, additional_args);
if(download_result == DownloadResult::OK) {
//fprintf(stderr, "Failed to get captcha, response: %s\n", response.c_str());
challenge_response_callback(google_captcha_parse_request_challenge_response(api_key, response));
@@ -131,15 +131,15 @@ namespace QuickMedia {
return result;
}
- std::future<bool> google_captcha_post_solution(const std::string &api_key, const std::string &captcha_id, std::array<bool, 9> selected_images, PostSolutionResponse solution_response_callback, bool use_tor) {
- return std::async(std::launch::async, [solution_response_callback, api_key, captcha_id, selected_images, use_tor]() {
+ std::future<bool> google_captcha_post_solution(const std::string &api_key, const std::string &captcha_id, std::array<bool, 9> selected_images, PostSolutionResponse solution_response_callback) {
+ return std::async(std::launch::async, [solution_response_callback, api_key, captcha_id, selected_images]() {
std::string captcha_url = "https://www.google.com/recaptcha/api/fallback?k=" + api_key;
std::string response;
std::vector<CommandArg> additional_args = {
CommandArg{"-H", "Referer: " + captcha_url},
CommandArg{"--data", "c=" + captcha_id + "&" + build_post_solution_response(selected_images)}
};
- DownloadResult post_result = download_to_string(captcha_url, response, additional_args, use_tor);
+ DownloadResult post_result = download_to_string(captcha_url, response, additional_args);
if(post_result == DownloadResult::OK) {
//fprintf(stderr, "Failed to post captcha solution, response: %s\n", response.c_str());
std::optional<std::string> captcha_post_id = google_captcha_parse_submit_solution_response(response);
diff --git a/src/Json.cpp b/src/Json.cpp
index 86703b2..683c4da 100644
--- a/src/Json.cpp
+++ b/src/Json.cpp
@@ -9,8 +9,8 @@ namespace QuickMedia {
return nullValue;
}
- DownloadResult download_json(rapidjson::Document &result, const std::string &url, std::vector<CommandArg> additional_args, bool use_tor, bool use_browser_useragent, std::string *err_msg) {
- if(download_to_json(url, result, std::move(additional_args), use_tor, use_browser_useragent, err_msg == nullptr) != DownloadResult::OK) {
+ DownloadResult download_json(rapidjson::Document &result, const std::string &url, std::vector<CommandArg> additional_args, bool use_browser_useragent, std::string *err_msg) {
+ if(download_to_json(url, result, std::move(additional_args), use_browser_useragent, err_msg == nullptr) != DownloadResult::OK) {
// Cant get error since we parse directly to json. TODO: Make this work somehow?
if(err_msg)
*err_msg = "Failed to download/parse json";
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index b11befe..06abf22 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -452,18 +452,17 @@ namespace QuickMedia {
}
static void usage() {
- fprintf(stderr, "usage: QuickMedia <plugin> [--tor] [--no-video] [--use-system-mpv-config] [--dir <directory>]\n");
+ fprintf(stderr, "usage: QuickMedia <plugin> [--no-video] [--use-system-mpv-config] [--dir <directory>]\n");
fprintf(stderr, "OPTIONS:\n");
fprintf(stderr, " plugin The plugin to use. Should be either 4chan, manganelo, mangatown, mangadex, pornhub, youtube, spotify, soundcloud, nyaa.si, matrix, file-manager or pipe\n");
fprintf(stderr, " --no-video Only play audio when playing a video. Disabled by default\n");
- fprintf(stderr, " --tor Use tor. Disabled by default\n");
fprintf(stderr, " --use-system-mpv-config Use system mpv config instead of no config. Disabled by default\n");
fprintf(stderr, " --upscale-images Upscale low-resolution manga pages using waifu2x-ncnn-vulkan. Disabled by default\n");
fprintf(stderr, " --upscale-images-always Upscale manga pages using waifu2x-ncnn-vulkan, no matter what the original image resolution is. Disabled by default\n");
fprintf(stderr, " --dir Set the start directory when using file-manager\n");
fprintf(stderr, "EXAMPLES:\n");
- fprintf(stderr, "QuickMedia manganelo\n");
- fprintf(stderr, "QuickMedia youtube --tor\n");
+ fprintf(stderr, " QuickMedia manganelo\n");
+ fprintf(stderr, " QuickMedia --upscale-images-always manganelo\n");
}
static bool is_manga_plugin(const char *plugin_name) {
@@ -526,9 +525,7 @@ namespace QuickMedia {
}
}
- if(strcmp(argv[i], "--tor") == 0) {
- use_tor = true;
- } else if(strcmp(argv[i], "--no-video") == 0) {
+ if(strcmp(argv[i], "--no-video") == 0) {
no_video = true;
} else if(strcmp(argv[i], "--use-system-mpv-config") == 0) {
use_system_mpv_config = true;
@@ -565,11 +562,6 @@ namespace QuickMedia {
return -1;
}
- if(use_tor && !is_program_executable_by_name("torsocks")) {
- fprintf(stderr, "torsocks needs to be installed when using the --tor option\n");
- return -2;
- }
-
if(upscale_image_action != UpscaleImageAction::NO) {
if(!is_manga_plugin(plugin_name)) {
fprintf(stderr, "Option --upscale-images/-upscale-images-force is only valid for manganelo, mangatown and mangadex\n");
@@ -709,8 +701,6 @@ namespace QuickMedia {
}
if(matrix) {
- matrix->use_tor = use_tor;
-
if(matrix->load_cached_session() == PluginResult::OK) {
current_page = PageType::CHAT;
} else {
@@ -718,7 +708,6 @@ namespace QuickMedia {
current_page = PageType::CHAT_LOGIN;
chat_login_page();
}
-
after_matrix_login_page();
}
@@ -957,10 +946,6 @@ namespace QuickMedia {
body_size = sf::Vector2f(body_width, window_size.y - search_bottom - body_padding_vertical - tab_h);
}
- bool Program::is_tor_enabled() {
- return use_tor;
- }
-
std::unique_ptr<Body> Program::create_body() {
auto body = std::make_unique<Body>(this, loading_icon);
body->thumbnail_mask_shader = &circle_mask_shader;
@@ -1776,7 +1761,7 @@ namespace QuickMedia {
}
TaskResult download_file_result = run_task_with_loading_screen([this, &video_path, video_url]() {
- return download_to_file(video_url, video_path.data, {}, use_tor, true) == DownloadResult::OK;
+ return download_to_file(video_url, video_path.data, {}, true) == DownloadResult::OK;
});
switch(download_file_result) {
case TaskResult::TRUE: {
@@ -1836,7 +1821,7 @@ namespace QuickMedia {
video_url_converted = video_url;
}
- video_player = std::make_unique<VideoPlayer>(use_tor, no_video, use_system_mpv_config, resume_video, is_matrix, video_event_callback, on_window_create, resources_root, get_largest_monitor_height(disp));
+ video_player = std::make_unique<VideoPlayer>(no_video, use_system_mpv_config, resume_video, is_matrix, video_event_callback, on_window_create, resources_root, get_largest_monitor_height(disp));
VideoPlayer::Error err = video_player->load_video(video_url_converted.c_str(), window.getSystemHandle(), plugin_name, video_title);
if(err != VideoPlayer::Error::OK) {
std::string err_msg = "Failed to play url: ";
@@ -2014,7 +1999,7 @@ namespace QuickMedia {
if(page_changed) {
current_page = PageType::VIDEO_CONTENT;
- //video_player = std::make_unique<VideoPlayer>(use_tor, no_video, use_system_mpv_config, true, video_event_callback, on_window_create, resources_root);
+ //video_player = std::make_unique<VideoPlayer>(no_video, use_system_mpv_config, true, video_event_callback, on_window_create, resources_root);
load_video_error_check(true);
} else {
XMapWindow(disp, video_player_window);
@@ -2234,7 +2219,7 @@ namespace QuickMedia {
// TODO: Download directly to file instead. TODO: Move to page
std::string image_content;
- if(download_to_string(url, image_content, extra_args, is_tor_enabled(), true) != DownloadResult::OK || image_content.size() <= 255) {
+ if(download_to_string(url, image_content, extra_args, true) != DownloadResult::OK || image_content.size() <= 255) {
if(strcmp(images_page->get_service_name(), "manganelo") == 0) {
bool try_backup_url = false;
std::string new_url = url;
@@ -2246,7 +2231,7 @@ namespace QuickMedia {
if(try_backup_url) {
image_content.clear();
- if(download_to_string(new_url, image_content, extra_args, is_tor_enabled(), true) != DownloadResult::OK || image_content.size() <= 255) {
+ if(download_to_string(new_url, image_content, extra_args, true) != DownloadResult::OK || image_content.size() <= 255) {
show_notification("QuickMedia", "Failed to download image: " + new_url, Urgency::CRITICAL);
return true;
}
@@ -2674,7 +2659,7 @@ namespace QuickMedia {
// TODO: Make this work with other sites than 4chan
auto request_google_captcha_image = [this, &captcha_texture, &captcha_image_mutex, &navigation_stage, &captcha_sprite, &challenge_description_text](GoogleCaptchaChallengeInfo &challenge_info) {
std::string payload_image_data;
- DownloadResult download_image_result = download_to_string(challenge_info.payload_url, payload_image_data, {}, is_tor_enabled());
+ DownloadResult download_image_result = download_to_string(challenge_info.payload_url, payload_image_data, {});
if(download_image_result == DownloadResult::OK) {
std::lock_guard<std::mutex> lock(captcha_image_mutex);
sf::Image captcha_image;
@@ -2711,7 +2696,7 @@ namespace QuickMedia {
show_notification("QuickMedia", "Failed to get captcha challenge", Urgency::CRITICAL);
navigation_stage = NavigationStage::VIEWING_COMMENTS;
}
- }, is_tor_enabled());
+ });
};
Entry comment_input("Press i to begin writing a comment...");
@@ -2862,7 +2847,7 @@ namespace QuickMedia {
if(!selected_item || selected_item->attached_content_url.empty()) {
return image_data;
}
- if(download_to_string_cache(selected_item->attached_content_url, image_data, {}, is_tor_enabled()) != DownloadResult::OK) {
+ if(download_to_string_cache(selected_item->attached_content_url, image_data, {}) != DownloadResult::OK) {
show_notification("QuickMedia", "Failed to download image: " + selected_item->attached_content_url, Urgency::CRITICAL);
image_data.clear();
}
@@ -2959,7 +2944,7 @@ namespace QuickMedia {
}
request_google_captcha_image(challenge_info);
}
- }, is_tor_enabled());
+ });
}
}
@@ -4727,7 +4712,7 @@ namespace QuickMedia {
}
if(current_room && current_room->body_item && room_avatar_thumbnail_data->loading_state == LoadingState::NOT_LOADED)
- AsyncImageLoader::get_instance().load_thumbnail(current_room->body_item->thumbnail_url, false, AVATAR_THUMBNAIL_SIZE, use_tor, room_avatar_thumbnail_data);
+ AsyncImageLoader::get_instance().load_thumbnail(current_room->body_item->thumbnail_url, false, AVATAR_THUMBNAIL_SIZE, room_avatar_thumbnail_data);
if(room_avatar_thumbnail_data->loading_state == LoadingState::FINISHED_LOADING && room_avatar_thumbnail_data->image->getSize().x > 0 && room_avatar_thumbnail_data->image->getSize().y > 0) {
if(!room_avatar_thumbnail_data->texture.loadFromImage(*room_avatar_thumbnail_data->image))
diff --git a/src/VideoPlayer.cpp b/src/VideoPlayer.cpp
index adda2bf..3f3df0c 100644
--- a/src/VideoPlayer.cpp
+++ b/src/VideoPlayer.cpp
@@ -18,9 +18,8 @@ const int MAX_RETRIES_CONNECT = 1000;
const int READ_TIMEOUT_MS = 200;
namespace QuickMedia {
- VideoPlayer::VideoPlayer(bool use_tor, bool no_video, bool use_system_mpv_config, bool resume_playback, bool keep_open, EventCallbackFunc _event_callback, VideoPlayerWindowCreateCallback _window_create_callback, const std::string &resource_root, int monitor_height) :
+ VideoPlayer::VideoPlayer(bool no_video, bool use_system_mpv_config, bool resume_playback, bool keep_open, EventCallbackFunc _event_callback, VideoPlayerWindowCreateCallback _window_create_callback, const std::string &resource_root, int monitor_height) :
exit_status(0),
- use_tor(use_tor),
no_video(no_video),
use_system_mpv_config(use_system_mpv_config),
resume_playback(resume_playback),
@@ -74,8 +73,6 @@ namespace QuickMedia {
const std::string parent_window_str = std::to_string(parent_window);
std::vector<const char*> args;
- if(use_tor)
- args.push_back("torsocks");
std::string input_ipc_server_arg = "--input-ipc-server=";
input_ipc_server_arg += ipc_server_path;
@@ -133,7 +130,7 @@ namespace QuickMedia {
/*
std::string ytdl_options_arg;
- if(!use_tor && !plugin_name.empty()) {
+ if(!plugin_name.empty()) {
Path cookies_filepath;
if(get_cookies_filepath(cookies_filepath, plugin_name) != 0) {
fprintf(stderr, "Warning: Failed to create %s cookies file\n", plugin_name.c_str());
diff --git a/src/plugins/Fourchan.cpp b/src/plugins/Fourchan.cpp
index 2c62ba1..c91bd0d 100644
--- a/src/plugins/Fourchan.cpp
+++ b/src/plugins/Fourchan.cpp
@@ -528,7 +528,7 @@ namespace QuickMedia {
}
std::string response;
- if(download_to_string(url, response, additional_args, is_tor_enabled(), true) != DownloadResult::OK)
+ if(download_to_string(url, response, additional_args, true) != DownloadResult::OK)
return PostResult::ERR;
if(response.find("successful") != std::string::npos)
diff --git a/src/plugins/Mangadex.cpp b/src/plugins/Mangadex.cpp
index 6df0903..63ceb3f 100644
--- a/src/plugins/Mangadex.cpp
+++ b/src/plugins/Mangadex.cpp
@@ -64,7 +64,7 @@ namespace QuickMedia {
CommandArg cookie_arg = { "-H", "cookie: mangadex_rememberme_token=" + rememberme_token };
std::string website_data;
- if(download_to_string(url, website_data, {std::move(cookie_arg)}, is_tor_enabled(), true) != DownloadResult::OK)
+ if(download_to_string(url, website_data, {std::move(cookie_arg)}, true) != DownloadResult::OK)
return SearchResult::NET_ERR;
QuickMediaHtmlSearch html_search;
@@ -121,7 +121,7 @@ namespace QuickMedia {
std::string request_url = "https://mangadex.org/api/?id=" + title_url_extract_manga_id(url) + "&type=manga";
rapidjson::Document json_root;
- DownloadResult result = download_to_json(request_url, json_root, {}, is_tor_enabled(), true);
+ DownloadResult result = download_to_json(request_url, json_root, {}, true);
if(result != DownloadResult::OK) return download_result_to_plugin_result(result);
if(!json_root.IsObject())
@@ -232,7 +232,7 @@ namespace QuickMedia {
bool MangadexImagesPage::save_mangadex_cookies(const std::string &url, const std::string &cookie_filepath) {
CommandArg cookie_arg = { "-c", cookie_filepath };
std::string server_response;
- if(download_to_string(url, server_response, {std::move(cookie_arg)}, is_tor_enabled(), true) != DownloadResult::OK)
+ if(download_to_string(url, server_response, {std::move(cookie_arg)}, true) != DownloadResult::OK)
return false;
return true;
diff --git a/src/plugins/Manganelo.cpp b/src/plugins/Manganelo.cpp
index f87081c..7d1e8b3 100644
--- a/src/plugins/Manganelo.cpp
+++ b/src/plugins/Manganelo.cpp
@@ -25,12 +25,12 @@ namespace QuickMedia {
return true;
}
- static PluginResult submit_manga(Page *page, const std::string &title, const std::string &url, std::vector<Tab> &result_tabs, bool use_tor) {
+ static PluginResult submit_manga(Page *page, const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
BodyItems chapters_items;
std::vector<Creator> creators;
std::string website_data;
- if(download_to_string(url, website_data, {}, use_tor, true) != DownloadResult::OK)
+ if(download_to_string(url, website_data, {}, true) != DownloadResult::OK)
return PluginResult::NET_ERR;
QuickMediaHtmlSearch html_search;
@@ -117,7 +117,7 @@ namespace QuickMedia {
}
PluginResult ManganeloSearchPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
- return submit_manga(this, title, url, result_tabs, is_tor_enabled());
+ return submit_manga(this, title, url, result_tabs);
}
PluginResult ManganeloChaptersPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
@@ -159,12 +159,12 @@ namespace QuickMedia {
}
PluginResult ManganeloCreatorPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
- return submit_manga(this, title, url, result_tabs, is_tor_enabled());
+ return submit_manga(this, title, url, result_tabs);
}
PluginResult ManganeloCreatorPage::lazy_fetch(BodyItems &result_items) {
std::string website_data;
- if(download_to_string(creator.url, website_data, {}, is_tor_enabled(), true) != DownloadResult::OK)
+ if(download_to_string(creator.url, website_data, {}, true) != DownloadResult::OK)
return PluginResult::NET_ERR;
QuickMediaHtmlSearch html_search;
@@ -241,7 +241,7 @@ namespace QuickMedia {
return ImageResult::OK;
std::string website_data;
- if(download_to_string(url, website_data, {}, is_tor_enabled(), true) != DownloadResult::OK)
+ if(download_to_string(url, website_data, {}, true) != DownloadResult::OK)
return ImageResult::NET_ERR;
QuickMediaHtmlSearch html_search;
diff --git a/src/plugins/Mangatown.cpp b/src/plugins/Mangatown.cpp
index 1d4d71a..ec5f279 100644
--- a/src/plugins/Mangatown.cpp
+++ b/src/plugins/Mangatown.cpp
@@ -12,13 +12,13 @@ namespace QuickMedia {
return atoi(str) != 0;
}
- static SearchResult search_page(const std::string &str, int page, bool use_tor, BodyItems &result_items) {
+ static SearchResult search_page(const std::string &str, int page, BodyItems &result_items) {
std::string url = "https://www.mangatown.com/search?name=";
url += url_param_encode(str);
url += "&page=" + std::to_string(page);
std::string website_data;
- if(download_to_string(url, website_data, {}, use_tor, true) != DownloadResult::OK)
+ if(download_to_string(url, website_data, {}, true) != DownloadResult::OK)
return SearchResult::NET_ERR;
if(website_data.empty())
@@ -61,18 +61,18 @@ namespace QuickMedia {
}
SearchResult MangatownSearchPage::search(const std::string &str, BodyItems &result_items) {
- return search_page(str, 1, is_tor_enabled(), result_items);
+ return search_page(str, 1, result_items);
}
PluginResult MangatownSearchPage::get_page(const std::string &str, int page, BodyItems &result_items) {
- return search_result_to_plugin_result(search_page(str, 1 + page, is_tor_enabled(), result_items));
+ return search_result_to_plugin_result(search_page(str, 1 + page, result_items));
}
PluginResult MangatownSearchPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
BodyItems chapters_items;
std::string website_data;
- if(download_to_string(url, website_data, {}, is_tor_enabled(), true) != DownloadResult::OK)
+ if(download_to_string(url, website_data, {}, true) != DownloadResult::OK)
return PluginResult::NET_ERR;
QuickMediaHtmlSearch html_search;
@@ -149,7 +149,7 @@ namespace QuickMedia {
for(const std::string &full_url : chapter_image_urls) {
std::string image_src;
std::string website_data;
- if(download_to_string_cache(full_url, website_data, {}, is_tor_enabled(), true) != DownloadResult::OK)
+ if(download_to_string_cache(full_url, website_data, {}, true) != DownloadResult::OK)
break;
QuickMediaHtmlSearch html_search;
@@ -192,7 +192,7 @@ namespace QuickMedia {
int num_pages = 0;
std::string website_data;
- if(download_to_string(url, website_data, {}, is_tor_enabled(), true) != DownloadResult::OK)
+ if(download_to_string(url, website_data, {}, true) != DownloadResult::OK)
return ImageResult::NET_ERR;
QuickMediaHtmlSearch html_search;
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index 21459d0..20bc31e 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -1115,7 +1115,7 @@ namespace QuickMedia {
rapidjson::Document json_root;
std::string err_msg;
- DownloadResult download_result = download_json(json_root, url, additional_args, use_tor, true, &err_msg);
+ DownloadResult download_result = download_json(json_root, url, additional_args, true, &err_msg);
if(download_result != DownloadResult::OK) {
fprintf(stderr, "/sync failed\n");
goto sync_end;
@@ -1171,7 +1171,7 @@ namespace QuickMedia {
snprintf(url, sizeof(url), "%s/_matrix/client/r0/notifications?limit=100&only=highlight", homeserver.c_str());
rapidjson::Document json_root;
- DownloadResult download_result = download_json(json_root, url, std::move(additional_args), use_tor, true);
+ DownloadResult download_result = download_json(json_root, url, std::move(additional_args), true);
if(download_result != DownloadResult::OK || !json_root.IsObject()) {
fprintf(stderr, "Fetching notifications failed!\n");
return;
@@ -1192,7 +1192,7 @@ namespace QuickMedia {
rapidjson::Document json_root;
std::string err_msg;
- DownloadResult download_result = download_json(json_root, url, additional_args, use_tor, true, &err_msg);
+ DownloadResult download_result = download_json(json_root, url, additional_args, true, &err_msg);
if(download_result != DownloadResult::OK) {
fprintf(stderr, "/sync for additional messages failed\n");
return;
@@ -2526,7 +2526,7 @@ namespace QuickMedia {
snprintf(url, sizeof(url), "%s/_matrix/client/r0/rooms/%s/messages?from=%s&limit=20&dir=b&filter=%s", homeserver.c_str(), room_data->id.c_str(), from.c_str(), filter.c_str());
rapidjson::Document json_root;
- DownloadResult download_result = download_json(json_root, url, std::move(additional_args), use_tor, true);
+ DownloadResult download_result = download_json(json_root, url, std::move(additional_args), true);
if(download_result != DownloadResult::OK) return download_result_to_plugin_result(download_result);
if(!json_root.IsObject())
@@ -2740,7 +2740,7 @@ namespace QuickMedia {
snprintf(request_url, sizeof(request_url), "%s/_matrix/client/r0/rooms/%s/send/m.room.message/%s", homeserver.c_str(), room->id.c_str(), transaction_id.c_str());
rapidjson::Document json_root;
- DownloadResult download_result = download_json(json_root, request_url, std::move(additional_args), use_tor, true);
+ DownloadResult download_result = download_json(json_root, request_url, std::move(additional_args), true);
if(download_result != DownloadResult::OK) return download_result_to_plugin_result(download_result);
if(!json_root.IsObject())
@@ -2887,7 +2887,7 @@ namespace QuickMedia {
snprintf(request_url, sizeof(request_url), "%s/_matrix/client/r0/rooms/%s/send/m.room.message/%s", homeserver.c_str(), room->id.c_str(), transaction_id.c_str());
rapidjson::Document json_root;
- DownloadResult download_result = download_json(json_root, request_url, std::move(additional_args), use_tor, true);
+ DownloadResult download_result = download_json(json_root, request_url, std::move(additional_args), true);
if(download_result != DownloadResult::OK) return download_result_to_plugin_result(download_result);
if(!json_root.IsObject())
@@ -2953,7 +2953,7 @@ namespace QuickMedia {
snprintf(request_url, sizeof(request_url), "%s/_matrix/client/r0/rooms/%s/send/m.room.message/%s", homeserver.c_str(), room->id.c_str(), transaction_id.c_str());
rapidjson::Document json_root;
- DownloadResult download_result = download_json(json_root, request_url, std::move(additional_args), use_tor, true);
+ DownloadResult download_result = download_json(json_root, request_url, std::move(additional_args), true);
if(download_result != DownloadResult::OK) return download_result_to_plugin_result(download_result);
if(!json_root.IsObject())
@@ -2999,7 +2999,7 @@ namespace QuickMedia {
snprintf(request_url, sizeof(request_url), "%s/_matrix/client/r0/rooms/%s/send/m.reaction/%s", homeserver.c_str(), room->id.c_str(), transaction_id.c_str());
rapidjson::Document json_root;
- DownloadResult download_result = download_json(json_root, request_url, std::move(additional_args), use_tor, true);
+ DownloadResult download_result = download_json(json_root, request_url, std::move(additional_args), true);
if(download_result != DownloadResult::OK) return download_result_to_plugin_result(download_result);
if(!json_root.IsObject())
@@ -3047,7 +3047,7 @@ namespace QuickMedia {
snprintf(url, sizeof(url), "%s/_matrix/client/r0/rooms/%s/event/%s", homeserver.c_str(), room->id.c_str(), event_id.c_str());
#endif
std::string response;
- DownloadResult download_result = download_to_string_cache(url, response, std::move(additional_args), use_tor, true, [](std::string &response) {
+ DownloadResult download_result = download_to_string_cache(url, response, std::move(additional_args), true, [](std::string &response) {
rapidjson::Document json_root;
rapidjson::ParseResult parse_result = json_root.Parse(response.c_str(), response.size());
if(parse_result.IsError() || !json_root.IsObject())
@@ -3223,7 +3223,7 @@ namespace QuickMedia {
snprintf(url, sizeof(url), "%s/_matrix/media/r0/upload?filename=%s", homeserver.c_str(), filename_escaped.c_str());
rapidjson::Document json_root;
- DownloadResult download_result = download_json(json_root, url, std::move(additional_args), use_tor, true, &err_msg);
+ DownloadResult download_result = download_json(json_root, url, std::move(additional_args), true, &err_msg);
if(download_result != DownloadResult::OK) return download_result_to_plugin_result(download_result);
if(!json_root.IsObject()) {
@@ -3271,7 +3271,7 @@ namespace QuickMedia {
};
rapidjson::Document json_root;
- DownloadResult download_result = download_json(json_root, homeserver + "/_matrix/client/r0/login", std::move(additional_args), use_tor, true, &err_msg);
+ DownloadResult download_result = download_json(json_root, homeserver + "/_matrix/client/r0/login", std::move(additional_args), true, &err_msg);
if(download_result != DownloadResult::OK) return download_result_to_plugin_result(download_result);
Path matrix_sync_data_path = get_cache_dir().join("matrix").join("sync_data.json");
@@ -3340,7 +3340,7 @@ namespace QuickMedia {
};
std::string server_response;
- download_to_string(homeserver + "/_matrix/client/r0/logout", server_response, std::move(additional_args), use_tor, true);
+ download_to_string(homeserver + "/_matrix/client/r0/logout", server_response, std::move(additional_args), true);
// Make sure all fields are reset here!
rooms.clear();
@@ -3382,7 +3382,7 @@ namespace QuickMedia {
snprintf(url, sizeof(url), "%s/_matrix/client/r0/rooms/%s/redact/%s/%s", homeserver.c_str(), room->id.c_str(), message_typed->event_id.c_str(), transaction_id.c_str());
rapidjson::Document json_root;
- DownloadResult download_result = download_json(json_root, url, std::move(additional_args), use_tor, true, &err_msg);
+ DownloadResult download_result = download_json(json_root, url, std::move(additional_args), true, &err_msg);
if(download_result != DownloadResult::OK) return download_result_to_plugin_result(download_result);
if(!json_root.IsObject()) {
@@ -3467,7 +3467,7 @@ namespace QuickMedia {
};
std::string server_response;
- DownloadResult download_result = download_to_string(homeserver + "/_matrix/client/r0/rooms/" + room->id + "/typing/" + url_param_encode(my_user_id) , server_response, std::move(additional_args), use_tor, true);
+ DownloadResult download_result = download_to_string(homeserver + "/_matrix/client/r0/rooms/" + room->id + "/typing/" + url_param_encode(my_user_id) , server_response, std::move(additional_args), true);
return download_result_to_plugin_result(download_result);
}
@@ -3487,7 +3487,7 @@ namespace QuickMedia {
};
std::string server_response;
- DownloadResult download_result = download_to_string(homeserver + "/_matrix/client/r0/rooms/" + room->id + "/typing/" + url_param_encode(my_user_id), server_response, std::move(additional_args), use_tor, true);
+ DownloadResult download_result = download_to_string(homeserver + "/_matrix/client/r0/rooms/" + room->id + "/typing/" + url_param_encode(my_user_id), server_response, std::move(additional_args), true);
return download_result_to_plugin_result(download_result);
}
@@ -3509,7 +3509,7 @@ namespace QuickMedia {
};
std::string server_response;
- DownloadResult download_result = download_to_string(homeserver + "/_matrix/client/r0/rooms/" + room->id + "/read_markers", server_response, std::move(additional_args), use_tor, true);
+ DownloadResult download_result = download_to_string(homeserver + "/_matrix/client/r0/rooms/" + room->id + "/read_markers", server_response, std::move(additional_args), true);
auto me = get_me(room);
if(me)
@@ -3537,7 +3537,7 @@ namespace QuickMedia {
room->read_marker_event_timestamp = timestamp;
std::string server_response;
- DownloadResult download_result = download_to_string(homeserver + "/_matrix/client/r0/user/" + my_user_id + "/rooms/" + room->id + "/account_data/qm.last_read_message_timestamp", server_response, std::move(additional_args), use_tor, true);
+ DownloadResult download_result = download_to_string(homeserver + "/_matrix/client/r0/user/" + my_user_id + "/rooms/" + room->id + "/account_data/qm.last_read_message_timestamp", server_response, std::move(additional_args), true);
return download_result_to_plugin_result(download_result);
}
@@ -3551,7 +3551,7 @@ namespace QuickMedia {
};
std::string server_response;
- DownloadResult download_result = download_to_string(homeserver + "/_matrix/client/r0/join/" + room_id, server_response, std::move(additional_args), use_tor, true);
+ DownloadResult download_result = download_to_string(homeserver + "/_matrix/client/r0/join/" + room_id, server_response, std::move(additional_args), true);
if(download_result == DownloadResult::OK) {
std::lock_guard<std::mutex> invite_lock(invite_mutex);
auto invite_it = invites.find(room_id);
@@ -3589,7 +3589,7 @@ namespace QuickMedia {
};
std::string server_response;
- DownloadResult download_result = download_to_string(homeserver + "/_matrix/client/r0/rooms/" + room_id + "/leave", server_response, std::move(additional_args), use_tor, true);
+ DownloadResult download_result = download_to_string(homeserver + "/_matrix/client/r0/rooms/" + room_id + "/leave", server_response, std::move(additional_args), true);
if(download_result == DownloadResult::OK) {
RoomData *room = get_room_by_id(room_id);
if(room) {
@@ -3626,7 +3626,7 @@ namespace QuickMedia {
snprintf(url, sizeof(url), "%s/_matrix/media/r0/config", homeserver.c_str());
rapidjson::Document json_root;
- DownloadResult download_result = download_json(json_root, url, std::move(additional_args), use_tor, true);
+ DownloadResult download_result = download_json(json_root, url, std::move(additional_args), true);
if(download_result != DownloadResult::OK) return download_result_to_plugin_result(download_result);
if(!json_root.IsObject())
@@ -3726,7 +3726,7 @@ namespace QuickMedia {
snprintf(url, sizeof(url), "%s/_matrix/client/r0/profile/%s", homeserver.c_str(), user_id.c_str());
rapidjson::Document json_root;
- DownloadResult download_result = download_json(json_root, url, {}, use_tor, true);
+ DownloadResult download_result = download_json(json_root, url, {}, true);
if(download_result != DownloadResult::OK || !json_root.IsObject()) {
fprintf(stderr, "Fetching profile for user %s failed!\n", user_id.c_str());
auto user = get_user_by_id(room, user_id);
@@ -3748,7 +3748,7 @@ namespace QuickMedia {
snprintf(url, sizeof(url), "%s/_matrix/client/r0/rooms/%s/joined_members", homeserver.c_str(), room->id.c_str());
rapidjson::Document json_root;
- DownloadResult download_result = download_json(json_root, url, std::move(additional_args), use_tor, true);
+ DownloadResult download_result = download_json(json_root, url, std::move(additional_args), true);
if(download_result != DownloadResult::OK || !json_root.IsObject()) {
fprintf(stderr, "Fetching users for room %s failed!\n", room->id.c_str());
return;
@@ -3795,7 +3795,7 @@ namespace QuickMedia {
snprintf(url, sizeof(url), "%s/_matrix/client/r0/rooms/%s/members?membership=join", homeserver.c_str(), room->id.c_str());
rapidjson::Document json_root;
- DownloadResult download_result = download_json(json_root, url, std::move(additional_args), use_tor, true);
+ DownloadResult download_result = download_json(json_root, url, std::move(additional_args), true);
if(download_result != DownloadResult::OK || !json_root.IsObject()) {
fprintf(stderr, "Fetching users for room %s failed!\n", room->id.c_str());
return;
@@ -3835,7 +3835,7 @@ namespace QuickMedia {
snprintf(url, sizeof(url), "%s/_matrix/client/r0/user/%s/filter", homeserver.c_str(), user_id.c_str());
rapidjson::Document json_root;
- DownloadResult download_result = download_json(json_root, url, std::move(additional_args), use_tor, true);
+ DownloadResult download_result = download_json(json_root, url, std::move(additional_args), true);
if(download_result != DownloadResult::OK || !json_root.IsObject()) return FILTER;
const rapidjson::Value &filter_id_json = GetMember(json_root, "filter_id");
diff --git a/src/plugins/NyaaSi.cpp b/src/plugins/NyaaSi.cpp
index ea482ef..ecc769a 100644
--- a/src/plugins/NyaaSi.cpp
+++ b/src/plugins/NyaaSi.cpp
@@ -41,12 +41,12 @@ namespace QuickMedia {
// TODO: Also show the number of comments for each torrent. TODO: Optimize?
// TODO: Show each field as seperate columns instead of seperating by |
- static SearchResult search_page(const std::string &list_url, const std::string &text, int page, bool use_tor, BodyItems &result_items) {
+ static SearchResult search_page(const std::string &list_url, const std::string &text, int page, BodyItems &result_items) {
std::string full_url = "https://nyaa.si/?c=" + list_url + "&f=0&p=" + std::to_string(page) + "&q=";
full_url += url_param_encode(text);
std::string website_data;
- if(download_to_string(full_url, website_data, {}, use_tor, true) != DownloadResult::OK)
+ if(download_to_string(full_url, website_data, {}, true) != DownloadResult::OK)
return SearchResult::NET_ERR;
size_t tbody_begin = website_data.find("<tbody>");
@@ -179,7 +179,7 @@ namespace QuickMedia {
PluginResult NyaaSiCategoryPage::submit(const std::string &title, const std::string &url, std::vector<Tab> &result_tabs) {
BodyItems result_items;
- SearchResult search_result = search_page(url, "", 1, is_tor_enabled(), result_items);
+ SearchResult search_result = search_page(url, "", 1, result_items);
if(search_result != SearchResult::OK) return search_result_to_plugin_result(search_result);
auto body = create_body();
@@ -216,11 +216,11 @@ namespace QuickMedia {
}
SearchResult NyaaSiSearchPage::search(const std::string &str, BodyItems &result_items) {
- return search_page(category_id, str, 1, is_tor_enabled(), result_items);
+ return search_page(category_id, str, 1, result_items);
}
PluginResult NyaaSiSearchPage::get_page(const std::string &str, int page, BodyItems &result_items) {
- return search_result_to_plugin_result(search_page(category_id, str, 1 + page, is_tor_enabled(), result_items));
+ return search_result_to_plugin_result(search_page(category_id, str, 1 + page, result_items));
}
PluginResult NyaaSiSearchPage::submit(const std::string&, const std::string &url, std::vector<Tab> &result_tabs) {
@@ -233,7 +233,7 @@ namespace QuickMedia {
std::string description;
std::string website_data;
- if(download_to_string(url, website_data, {}, is_tor_enabled(), true) != DownloadResult::OK)
+ if(download_to_string(url, website_data, {}, true) != DownloadResult::OK)
return PluginResult::NET_ERR;
QuickMediaHtmlSearch html_search;
diff --git a/src/plugins/Page.cpp b/src/plugins/Page.cpp
index 9e0e97a..21a33cb 100644
--- a/src/plugins/Page.cpp
+++ b/src/plugins/Page.cpp
@@ -5,7 +5,7 @@
namespace QuickMedia {
DownloadResult Page::download_json(Json::Value &result, const std::string &url, std::vector<CommandArg> additional_args, bool use_browser_useragent, std::string *err_msg) {
std::string server_response;
- if(download_to_string(url, server_response, std::move(additional_args), is_tor_enabled(), use_browser_useragent, err_msg == nullptr) != DownloadResult::OK) {
+ if(download_to_string(url, server_response, std::move(additional_args), use_browser_useragent, err_msg == nullptr) != DownloadResult::OK) {
if(err_msg)
*err_msg = server_response;
return DownloadResult::NET_ERR;
@@ -29,10 +29,6 @@ namespace QuickMedia {
return DownloadResult::OK;
}
- bool Page::is_tor_enabled() {
- return program->is_tor_enabled();
- }
-
std::unique_ptr<Body> Page::create_body() {
return program->create_body();
}
diff --git a/src/plugins/Pornhub.cpp b/src/plugins/Pornhub.cpp
index 74b66b6..4d30001 100644
--- a/src/plugins/Pornhub.cpp
+++ b/src/plugins/Pornhub.cpp
@@ -89,9 +89,9 @@ namespace QuickMedia {
}
}
- static SearchResult get_videos_in_page(const std::string &url, bool use_tor, BodyItems &result_items) {
+ static SearchResult get_videos_in_page(const std::string &url, BodyItems &result_items) {
std::string website_data;
- if(download_to_string(url, website_data, {}, use_tor) != DownloadResult::OK)
+ if(download_to_string(url, website_data, {}) != DownloadResult::OK)
return SearchResult::NET_ERR;
HtmlElement *html_root = html_parse(website_data.data(), website_data.size());
@@ -130,14 +130,14 @@ namespace QuickMedia {
SearchResult PornhubSearchPage::search(const std::string &str, BodyItems &result_items) {
std::string url = "https://www.pornhub.com/video/search?search=";
url += url_param_encode(str);
- return get_videos_in_page(url, is_tor_enabled(), result_items);
+ return get_videos_in_page(url, result_items);
}
PluginResult PornhubSearchPage::get_page(const std::string &str, int page, BodyItems &result_items) {
std::string url = "https://www.pornhub.com/video/search?search=";
url += url_param_encode(str);
url += "&page=" + std::to_string(1 + page);
- return search_result_to_plugin_result(get_videos_in_page(url, is_tor_enabled(), result_items));
+ return search_result_to_plugin_result(get_videos_in_page(url, result_items));
}
PluginResult PornhubSearchPage::submit(const std::string&, const std::string &url, std::vector<Tab> &result_tabs) {
@@ -152,7 +152,7 @@ namespace QuickMedia {
BodyItems PornhubVideoPage::get_related_media(const std::string &url, std::string&) {
BodyItems result_items;
- get_videos_in_page(url, is_tor_enabled(), result_items);
+ get_videos_in_page(url, result_items);
return result_items;
}