diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-03-30 00:45:51 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-03-30 00:45:51 +0200 |
commit | 539d9b457c4f30ef0731a479772212e7ce8bfd7c (patch) | |
tree | 256aae0d3524918ba80d609cadd9063cd06fb453 /src/plugins | |
parent | 3ac540c21116cb9cc91cfd1d7b0dd6f6ded31123 (diff) |
Remove tor option. Use torsocks instead (which is what quickmedia did anyways)
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/Fourchan.cpp | 2 | ||||
-rw-r--r-- | src/plugins/Mangadex.cpp | 6 | ||||
-rw-r--r-- | src/plugins/Manganelo.cpp | 12 | ||||
-rw-r--r-- | src/plugins/Mangatown.cpp | 14 | ||||
-rw-r--r-- | src/plugins/Matrix.cpp | 48 | ||||
-rw-r--r-- | src/plugins/NyaaSi.cpp | 12 | ||||
-rw-r--r-- | src/plugins/Page.cpp | 6 | ||||
-rw-r--r-- | src/plugins/Pornhub.cpp | 10 |
8 files changed, 53 insertions, 57 deletions
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; } |