aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-04-12 14:49:31 +0200
committerdec05eba <dec05eba@protonmail.com>2021-04-12 14:49:31 +0200
commite89aae6aa17d33cae1165af7c4f6cd688d9c22f5 (patch)
tree36d54b6f5f684c3b2b96971f0eeae483ac2dc2e4
parentbb7ad686d202bfe513104546cb2d77e6720d62a3 (diff)
Fix download of last page in manganelos
-rw-r--r--TODO3
-rw-r--r--src/plugins/Manganelo.cpp8
-rw-r--r--src/plugins/Manganelos.cpp17
-rw-r--r--src/plugins/Mangatown.cpp8
4 files changed, 20 insertions, 16 deletions
diff --git a/TODO b/TODO
index 3724d3b..efc890f 100644
--- a/TODO
+++ b/TODO
@@ -157,4 +157,5 @@ Add support for comments in live youtube videos, api is at: https://www.youtube.
Make video visible when reading comments (youtube).
Convert nyaa.si/spotify/soundcloud date from ISO date string to local time.
When ui is scaled then the predicated thumbnail size will be wrong since its scaled in Body but not in the plugins where they are requested.
-Check if get_page handlers in pages need to check if next batch is valid. If the server returns empty next batch we shouldn't fetch the first page... \ No newline at end of file
+Check if get_page handlers in pages need to check if next batch is valid. If the server returns empty next batch we shouldn't fetch the first page...
+Remove dependency on wget when using manganelo... Figure out why manganelo causes curl to stop download for up to 20 seconds and then fail. \ No newline at end of file
diff --git a/src/plugins/Manganelo.cpp b/src/plugins/Manganelo.cpp
index 6b526d4..8ce9e01 100644
--- a/src/plugins/Manganelo.cpp
+++ b/src/plugins/Manganelo.cpp
@@ -45,7 +45,7 @@ namespace QuickMedia {
const char *text = quickmedia_html_node_get_text(node);
if(href && text) {
auto item = BodyItem::create(strip(text));
- item->url = href;
+ item->url = strip(href);
item_data->push_back(std::move(item));
}
}, &chapters_items);
@@ -74,7 +74,7 @@ namespace QuickMedia {
if(href && text && strstr(href, "/author/story/")) {
Creator creator;
creator.name = strip(text);
- creator.url = href;
+ creator.url = strip(href);
creators->push_back(std::move(creator));
}
}, &creators);
@@ -195,7 +195,7 @@ namespace QuickMedia {
const char *title = quickmedia_html_node_get_attribute_value(node, "title");
if(href && title && strstr(href, "/manga/")) {
auto body_item = BodyItem::create(title);
- body_item->url = href;
+ body_item->url = strip(href);
item_data->push_back(std::move(body_item));
}
}, &result_items);
@@ -270,7 +270,7 @@ namespace QuickMedia {
auto *urls = (std::vector<std::string>*)userdata;
const char *src = quickmedia_html_node_get_attribute_value(node, "src");
if(src) {
- std::string image_url = src;
+ std::string image_url = strip(src);
urls->push_back(std::move(image_url));
}
}, &chapter_image_urls);
diff --git a/src/plugins/Manganelos.cpp b/src/plugins/Manganelos.cpp
index f67c313..9ab0915 100644
--- a/src/plugins/Manganelos.cpp
+++ b/src/plugins/Manganelos.cpp
@@ -29,7 +29,7 @@ namespace QuickMedia {
const char *title = quickmedia_html_node_get_attribute_value(node, "title");
if(href && title && strstr(href, "/manga/")) {
auto item = BodyItem::create(strip(title));
- item->url = href;
+ item->url = strip(href);
item_data->push_back(std::move(item));
}
}, &result_items);
@@ -80,7 +80,7 @@ namespace QuickMedia {
const char *text = quickmedia_html_node_get_text(node);
if(href && text) {
auto item = BodyItem::create(strip(text));
- item->url = href;
+ item->url = strip(href);
item_data->push_back(std::move(item));
}
}, &chapters_items);
@@ -160,11 +160,14 @@ namespace QuickMedia {
[](QuickMediaHtmlNode *node, void *userdata) {
std::vector<std::string> *chapter_image_urls = (std::vector<std::string>*)userdata;
const char *text = quickmedia_html_node_get_text(node);
- string_split(text, ',', [chapter_image_urls](const char *str, size_t size) {
- std::string url(str, size);
- chapter_image_urls->push_back(std::move(url));
- return true;
- });
+ if(text) {
+ string_split(text, ',', [chapter_image_urls](const char *str, size_t size) {
+ std::string url(str, size);
+ url = strip(url);
+ chapter_image_urls->push_back(std::move(url));
+ return true;
+ });
+ }
}, &chapter_image_urls);
cleanup:
diff --git a/src/plugins/Mangatown.cpp b/src/plugins/Mangatown.cpp
index b8547ce..04a1049 100644
--- a/src/plugins/Mangatown.cpp
+++ b/src/plugins/Mangatown.cpp
@@ -36,7 +36,7 @@ namespace QuickMedia {
const char *title = quickmedia_html_node_get_attribute_value(node, "title");
if(href && title && strncmp(href, "/manga/", 7) == 0) {
auto item = BodyItem::create(strip(title));
- item->url = mangatown_url + href;
+ item->url = mangatown_url + strip(href);
item_data->push_back(std::move(item));
}
}, &result_items);
@@ -87,7 +87,7 @@ namespace QuickMedia {
const char *text = quickmedia_html_node_get_text(node);
if(href && text && strncmp(href, "/manga/", 7) == 0) {
auto item = BodyItem::create(strip(text));
- item->url = mangatown_url + href;
+ item->url = mangatown_url + strip(href);
item_data->push_back(std::move(item));
}
}, &chapters_items);
@@ -172,9 +172,9 @@ namespace QuickMedia {
const char *src = quickmedia_html_node_get_attribute_value(node, "src");
if(src && strstr(src, "/store/manga/")) {
if(strncmp(src, "//", 2) == 0)
- *image_src = src + 2;
+ *image_src = strip(src + 2);
else
- *image_src = src;
+ *image_src = strip(src);
}
}, &image_src);