aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-10-03 09:49:25 +0200
committerdec05eba <dec05eba@protonmail.com>2020-10-03 09:50:25 +0200
commit27e748dec4792ac8612fb77e21a6d857a41a816c (patch)
tree5e6cd561ade545ee91261d73ef5ac9c62e326fd1 /src/plugins
parentc470174b397c7a81b7510f191e404cb895d462af (diff)
Nyaa.si: fetch next page when reaching the bottom
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/NyaaSi.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/plugins/NyaaSi.cpp b/src/plugins/NyaaSi.cpp
index 98c6eee..1cdfc5f 100644
--- a/src/plugins/NyaaSi.cpp
+++ b/src/plugins/NyaaSi.cpp
@@ -71,10 +71,19 @@ namespace QuickMedia {
return PluginResult::OK;
}
+
+ SearchResult NyaaSi::content_list_search(const std::string &list_url, const std::string &text, BodyItems &result_items) {
+ return search_page(list_url, text, 1, result_items);
+ }
+
+ SearchResult NyaaSi::content_list_search_page(const std::string &list_url, const std::string &text, int page, BodyItems &result_items) {
+ return search_page(list_url, text, 1 + page, result_items);
+ }
+
// TODO: Also show the number of comments for each torrent. TODO: Optimize?
// TODO: Show each field as seperate columns instead of seperating by |
- SearchResult NyaaSi::content_list_search(const std::string &list_url, const std::string &text, BodyItems &result_items) {
- std::string full_url = "https://nyaa.si/?c=" + list_url + "&f=0&p=1&q=";
+ SearchResult NyaaSi::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;
@@ -218,7 +227,7 @@ namespace QuickMedia {
}
PluginResult NyaaSi::get_content_list(const std::string &url, BodyItems &result_items) {
- return search_result_to_plugin_result(content_list_search(url, "", result_items));
+ return search_result_to_plugin_result(search_page(url, "", 1, result_items));
}
struct BodyItemImageContext {