aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-08-12 17:24:06 +0200
committerdec05eba <dec05eba@protonmail.com>2020-08-12 17:24:06 +0200
commit169057193c664f52267b818b2ff8bdcf73f21747 (patch)
tree3df7a7f5fb024c382e85e8529ba51f2f4402c45f /src
parentc4b5ca023f7f5e6ced71c1dfbb8ee3cf776a6b53 (diff)
Fix manganelo images not loading (cloudflare ddos protection)
Diffstat (limited to 'src')
-rw-r--r--src/QuickMedia.cpp15
-rw-r--r--src/plugins/Manganelo.cpp2
2 files changed, 13 insertions, 4 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index a7fca2d..d3627e1 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -1246,8 +1246,19 @@ namespace QuickMedia {
if(get_file_type(image_filepath) != FileType::FILE_NOT_FOUND)
return true;
+ std::vector<CommandArg> extra_args;
+ if(current_plugin->name == "manganelo") {
+ extra_args = {
+ CommandArg { "-H", "accept: image/webp,image/apng,image/*,*/*;q=0.8" },
+ CommandArg { "-H", "sec-fetch-site: cross-site" },
+ CommandArg { "-H", "sec-fetch-mode: no-cors" },
+ CommandArg { "-H", "sec-fetch-dest: image" },
+ CommandArg { "-H", "referer: https://manganelo.com/" }
+ };
+ }
+
std::string image_content;
- if(download_to_string(url, image_content, {}, current_plugin->use_tor) != DownloadResult::OK || image_content.size() <= 255) {
+ if(download_to_string(url, image_content, extra_args, current_plugin->use_tor, true) != DownloadResult::OK || image_content.size() <= 255) {
if(current_plugin->name == "manganelo") {
bool try_backup_url = false;
std::string new_url = url;
@@ -1259,7 +1270,7 @@ namespace QuickMedia {
if(try_backup_url) {
image_content.clear();
- if(download_to_string(new_url, image_content, {}, current_plugin->use_tor) != DownloadResult::OK || image_content.size() <= 255) {
+ if(download_to_string(new_url, image_content, extra_args, current_plugin->use_tor, true) != DownloadResult::OK || image_content.size() <= 255) {
show_notification("Manganelo", "Failed to download image: " + new_url, Urgency::CRITICAL);
return false;
}
diff --git a/src/plugins/Manganelo.cpp b/src/plugins/Manganelo.cpp
index 89f882c..a4c8809 100644
--- a/src/plugins/Manganelo.cpp
+++ b/src/plugins/Manganelo.cpp
@@ -125,9 +125,7 @@ namespace QuickMedia {
auto *urls = (std::vector<std::string>*)userdata;
const char *src = quickmedia_html_node_get_attribute_value(node, "src");
if(src) {
- // TODO: If image loads too slow, try switching mirror
std::string image_url = src;
- //string_replace_all(image_url, "s3.mkklcdnv3.com", "bu.mkklcdnbuv1.com");
urls->emplace_back(std::move(image_url));
}
}, &last_chapter_image_urls);