aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/Mangadex.cpp4
-rw-r--r--src/plugins/Manganelo.cpp20
-rw-r--r--src/plugins/Mangatown.cpp19
-rw-r--r--src/plugins/NyaaSi.cpp6
4 files changed, 40 insertions, 9 deletions
diff --git a/src/plugins/Mangadex.cpp b/src/plugins/Mangadex.cpp
index 63ceb3f..59126cb 100644
--- a/src/plugins/Mangadex.cpp
+++ b/src/plugins/Mangadex.cpp
@@ -87,13 +87,13 @@ namespace QuickMedia {
if(result != 0)
goto cleanup;
- BodyItemImageContext body_item_image_context;
+ BodyItemContext body_item_image_context;
body_item_image_context.body_items = &result_items;
body_item_image_context.index = 0;
result = quickmedia_html_find_nodes_xpath(&html_search, "//img",
[](QuickMediaHtmlNode *node, void *userdata) {
- auto *item_data = (BodyItemImageContext*)userdata;
+ auto *item_data = (BodyItemContext*)userdata;
const char *src = quickmedia_html_node_get_attribute_value(node, "src");
if(src && strncmp(src, "/images/manga/", 14) == 0 && item_data->index < item_data->body_items->size()) {
(*item_data->body_items)[item_data->index]->thumbnail_url = mangadex_url + src;
diff --git a/src/plugins/Manganelo.cpp b/src/plugins/Manganelo.cpp
index 7d1e8b3..6b526d4 100644
--- a/src/plugins/Manganelo.cpp
+++ b/src/plugins/Manganelo.cpp
@@ -49,6 +49,22 @@ namespace QuickMedia {
item_data->push_back(std::move(item));
}
}, &chapters_items);
+
+ BodyItemContext body_item_context;
+ body_item_context.body_items = &chapters_items;
+ body_item_context.index = 0;
+
+ quickmedia_html_find_nodes_xpath(&html_search, "//ul[class='row-content-chapter']//span",
+ [](QuickMediaHtmlNode *node, void *userdata) {
+ auto *item_data = (BodyItemContext*)userdata;
+ const char *class_attr = quickmedia_html_node_get_attribute_value(node, "class");
+ const char *text = quickmedia_html_node_get_text(node);
+ if(text && class_attr && strstr(class_attr, "chapter-time") && item_data->index < item_data->body_items->size()) {
+ std::string uploaded_date = strip(text);
+ (*item_data->body_items)[item_data->index]->set_description("Uploaded: " + uploaded_date);
+ item_data->index++;
+ }
+ }, &body_item_context);
quickmedia_html_find_nodes_xpath(&html_search, "//a[class='a-h']",
[](QuickMediaHtmlNode *node, void *userdata) {
@@ -187,13 +203,13 @@ namespace QuickMedia {
if(result != 0)
goto cleanup;
- BodyItemImageContext body_item_image_context;
+ BodyItemContext body_item_image_context;
body_item_image_context.body_items = &result_items;
body_item_image_context.index = 0;
result = quickmedia_html_find_nodes_xpath(&html_search, "//div[class='search-story-item']//a[class='item-img']//img",
[](QuickMediaHtmlNode *node, void *userdata) {
- auto *item_data = (BodyItemImageContext*)userdata;
+ auto *item_data = (BodyItemContext*)userdata;
const char *src = quickmedia_html_node_get_attribute_value(node, "src");
if(src && item_data->index < item_data->body_items->size()) {
(*item_data->body_items)[item_data->index]->thumbnail_url = src;
diff --git a/src/plugins/Mangatown.cpp b/src/plugins/Mangatown.cpp
index ec5f279..4e7046c 100644
--- a/src/plugins/Mangatown.cpp
+++ b/src/plugins/Mangatown.cpp
@@ -41,13 +41,13 @@ namespace QuickMedia {
}
}, &result_items);
- BodyItemImageContext body_item_image_context;
+ BodyItemContext body_item_image_context;
body_item_image_context.body_items = &result_items;
body_item_image_context.index = 0;
result = quickmedia_html_find_nodes_xpath(&html_search, "//a[class='manga_cover']/img",
[](QuickMediaHtmlNode *node, void *userdata) {
- auto *item_data = (BodyItemImageContext*)userdata;
+ auto *item_data = (BodyItemContext*)userdata;
const char *src = quickmedia_html_node_get_attribute_value(node, "src");
if(src && item_data->index < item_data->body_items->size()) {
(*item_data->body_items)[item_data->index]->thumbnail_url = src;
@@ -92,6 +92,21 @@ namespace QuickMedia {
}
}, &chapters_items);
+ BodyItemContext body_item_context;
+ body_item_context.body_items = &chapters_items;
+ body_item_context.index = 0;
+
+ quickmedia_html_find_nodes_xpath(&html_search, "//ul[class='chapter_list']//span[class='time']",
+ [](QuickMediaHtmlNode *node, void *userdata) {
+ auto *item_data = (BodyItemContext*)userdata;
+ const char *text = quickmedia_html_node_get_text(node);
+ if(text && item_data->index < item_data->body_items->size()) {
+ std::string uploaded_date = strip(text);
+ (*item_data->body_items)[item_data->index]->set_description("Uploaded: " + uploaded_date);
+ item_data->index++;
+ }
+ }, &body_item_context);
+
cleanup:
quickmedia_html_search_deinit(&html_search);
if(result != 0)
diff --git a/src/plugins/NyaaSi.cpp b/src/plugins/NyaaSi.cpp
index ecc769a..c005b31 100644
--- a/src/plugins/NyaaSi.cpp
+++ b/src/plugins/NyaaSi.cpp
@@ -335,13 +335,13 @@ namespace QuickMedia {
if(result != 0 || result_items.size() == comments_start_index)
goto cleanup;
- BodyItemImageContext body_item_image_context;
+ BodyItemContext body_item_image_context;
body_item_image_context.body_items = &result_items;
body_item_image_context.index = comments_start_index;
result = quickmedia_html_find_nodes_xpath(&html_search, "//div[id='comments']//img[class='avatar']",
[](QuickMediaHtmlNode *node, void *userdata) {
- auto *item_data = (BodyItemImageContext*)userdata;
+ auto *item_data = (BodyItemContext*)userdata;
const char *src = quickmedia_html_node_get_attribute_value(node, "src");
if(src && item_data->index < item_data->body_items->size()) {
(*item_data->body_items)[item_data->index]->thumbnail_url = src;
@@ -357,7 +357,7 @@ namespace QuickMedia {
result = quickmedia_html_find_nodes_xpath(&html_search, "//div[id='comments']//div[class='comment-content']",
[](QuickMediaHtmlNode *node, void *userdata) {
- auto *item_data = (BodyItemImageContext*)userdata;
+ auto *item_data = (BodyItemContext*)userdata;
const char *text = quickmedia_html_node_get_text(node);
if(text && item_data->index < item_data->body_items->size()) {
(*item_data->body_items)[item_data->index]->set_description(strip(text));