aboutsummaryrefslogtreecommitdiff
path: root/src/QuickMedia.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/QuickMedia.cpp')
-rw-r--r--src/QuickMedia.cpp22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 8e6f04e..d7c15b1 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -1052,9 +1052,25 @@ namespace QuickMedia {
return true;
std::string image_content;
- if(download_to_string(url, image_content, {}, current_plugin->use_tor) != DownloadResult::OK) {
- show_notification("Manganelo", "Failed to download image: " + url, Urgency::CRITICAL);
- return false;
+ if(download_to_string(url, image_content, {}, current_plugin->use_tor) != DownloadResult::OK || image_content.size() <= 255) {
+ bool try_backup_url = false;
+ std::string new_url = url;
+ if(string_replace_all(new_url, "s3.mkklcdnv3.com", "bu.mkklcdnbuv1.com") > 0) {
+ try_backup_url = true;
+ } else {
+ try_backup_url = (string_replace_all(new_url, "s41.mkklcdnv41.com", "bu.mkklcdnbuv1.com") > 0);
+ }
+
+ 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) {
+ show_notification("Manganelo", "Failed to download image: " + new_url, Urgency::CRITICAL);
+ return false;
+ }
+ } else {
+ show_notification("Manganelo", "Failed to download image: " + url, Urgency::CRITICAL);
+ return false;
+ }
}
if(file_overwrite(image_filepath, image_content) != 0) {