aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/Fourchan.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/plugins/Fourchan.cpp b/src/plugins/Fourchan.cpp
index 1dfe681..e65835a 100644
--- a/src/plugins/Fourchan.cpp
+++ b/src/plugins/Fourchan.cpp
@@ -374,6 +374,7 @@ namespace QuickMedia {
}
PluginResult Fourchan::get_thread_comments(const std::string &list_url, const std::string &url, BodyItems &result_items) {
+ cached_media_urls.clear();
std::string server_response;
if(download_to_string(fourchan_url + list_url + "/thread/" + url + ".json", server_response, {}, use_tor) != DownloadResult::OK)
return PluginResult::NET_ERR;
@@ -509,6 +510,7 @@ namespace QuickMedia {
std::string tim_str = std::to_string(tim.asInt64());
body_item->thumbnail_url = fourchan_image_url + list_url + "/" + tim_str + "s.jpg";
body_item->attached_content_url = fourchan_image_url + list_url + "/" + tim_str + ext_str;
+ cached_media_urls.push_back(body_item->attached_content_url);
}
++body_item_index;
@@ -547,4 +549,19 @@ namespace QuickMedia {
return PostResult::TRY_AGAIN;
return PostResult::ERR;
}
+
+ BodyItems Fourchan::get_related_media(const std::string &url) {
+ BodyItems body_items;
+ auto it = cached_media_urls.begin();
+ for(; it != cached_media_urls.end(); ++it) {
+ if(url == *it)
+ break;
+ }
+ for(; it != cached_media_urls.end(); ++it) {
+ auto body_item = std::make_unique<BodyItem>("");
+ body_item->url = *it;
+ body_items.push_back(std::move(body_item));
+ }
+ return body_items;
+ }
} \ No newline at end of file