aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/Manganelo.cpp6
-rw-r--r--src/plugins/Plugin.cpp6
-rw-r--r--src/plugins/Youtube.cpp14
3 files changed, 13 insertions, 13 deletions
diff --git a/src/plugins/Manganelo.cpp b/src/plugins/Manganelo.cpp
index e91baf0..ec522d2 100644
--- a/src/plugins/Manganelo.cpp
+++ b/src/plugins/Manganelo.cpp
@@ -3,7 +3,7 @@
#include <json/reader.h>
namespace QuickMedia {
- SearchResult Manganelo::search(const std::string &url, std::vector<std::unique_ptr<BodyItem>> &result_items) {
+ SearchResult Manganelo::search(const std::string &url, BodyItems &result_items) {
std::string website_data;
if(download_to_string(url, website_data) != DownloadResult::OK)
return SearchResult::NET_ERR;
@@ -15,7 +15,7 @@ namespace QuickMedia {
result = quickmedia_html_find_nodes_xpath(&html_search, "//div[class='chapter-list']/div[class='row']//a",
[](QuickMediaHtmlNode *node, void *userdata) {
- auto *item_data = (std::vector<std::unique_ptr<BodyItem>>*)userdata;
+ auto *item_data = (BodyItems*)userdata;
const char *href = quickmedia_html_node_get_attribute_value(node, "href");
const char *text = quickmedia_html_node_get_text(node);
if(href && text) {
@@ -50,7 +50,7 @@ namespace QuickMedia {
return true;
}
- SuggestionResult Manganelo::update_search_suggestions(const std::string &text, std::vector<std::unique_ptr<BodyItem>> &result_items) {
+ SuggestionResult Manganelo::update_search_suggestions(const std::string &text, BodyItems &result_items) {
std::string url = "https://manganelo.com/home_json_search";
std::string search_term = "searchword=";
search_term += url_param_encode(text);
diff --git a/src/plugins/Plugin.cpp b/src/plugins/Plugin.cpp
index 5d81aad..79c6403 100644
--- a/src/plugins/Plugin.cpp
+++ b/src/plugins/Plugin.cpp
@@ -10,19 +10,19 @@ static int accumulate_string(char *data, int size, void *userdata) {
}
namespace QuickMedia {
- SearchResult Plugin::search(const std::string &text, std::vector<std::unique_ptr<BodyItem>> &result_items) {
+ SearchResult Plugin::search(const std::string &text, BodyItems &result_items) {
(void)text;
(void)result_items;
return SearchResult::OK;
}
- SuggestionResult Plugin::update_search_suggestions(const std::string &text, std::vector<std::unique_ptr<BodyItem>> &result_items) {
+ SuggestionResult Plugin::update_search_suggestions(const std::string &text, BodyItems &result_items) {
(void)text;
(void)result_items;
return SuggestionResult::OK;
}
- std::vector<std::unique_ptr<BodyItem>> Plugin::get_related_media(const std::string &url) {
+ BodyItems Plugin::get_related_media(const std::string &url) {
(void)url;
return {};
}
diff --git a/src/plugins/Youtube.cpp b/src/plugins/Youtube.cpp
index 2a3f011..56e8574 100644
--- a/src/plugins/Youtube.cpp
+++ b/src/plugins/Youtube.cpp
@@ -12,7 +12,7 @@ namespace QuickMedia {
return strstr(str, substr);
}
- static void iterate_suggestion_result(const Json::Value &value, std::vector<std::unique_ptr<BodyItem>> &result_items, int &iterate_count) {
+ static void iterate_suggestion_result(const Json::Value &value, BodyItems &result_items, int &iterate_count) {
++iterate_count;
if(value.isArray()) {
for(const Json::Value &child : value) {
@@ -26,7 +26,7 @@ namespace QuickMedia {
}
// TODO: Speed this up by using string.find instead of parsing html
- SuggestionResult Youtube::update_search_suggestions(const std::string &text, std::vector<std::unique_ptr<BodyItem>> &result_items) {
+ SuggestionResult Youtube::update_search_suggestions(const std::string &text, BodyItems &result_items) {
// Keep this for backup. This is using search suggestion the same way youtube does it, but the results
// are not as good as doing an actual search.
#if 0
@@ -79,7 +79,7 @@ namespace QuickMedia {
return SuggestionResult::NET_ERR;
struct ItemData {
- std::vector<std::unique_ptr<BodyItem>> *result_items;
+ BodyItems *result_items;
size_t index;
};
ItemData item_data = { &result_items, 0 };
@@ -91,7 +91,7 @@ namespace QuickMedia {
result = quickmedia_html_find_nodes_xpath(&html_search, "//h3[class=\"yt-lockup-title\"]/a",
[](QuickMediaHtmlNode *node, void *userdata) {
- auto *result_items = (std::vector<std::unique_ptr<BodyItem>>*)userdata;
+ auto *result_items = (BodyItems*)userdata;
const char *href = quickmedia_html_node_get_attribute_value(node, "href");
const char *title = quickmedia_html_node_get_attribute_value(node, "title");
// Checking for watch?v helps skipping ads
@@ -127,8 +127,8 @@ namespace QuickMedia {
return result == 0 ? SuggestionResult::OK : SuggestionResult::ERR;
}
- std::vector<std::unique_ptr<BodyItem>> Youtube::get_related_media(const std::string &url) {
- std::vector<std::unique_ptr<BodyItem>> result_items;
+ BodyItems Youtube::get_related_media(const std::string &url) {
+ BodyItems result_items;
std::string website_data;
if(download_to_string(url, website_data) != DownloadResult::OK)
@@ -141,7 +141,7 @@ namespace QuickMedia {
result = quickmedia_html_find_nodes_xpath(&html_search, "//ul[class=\"video-list\"]//div[class=\"content-wrapper\"]/a",
[](QuickMediaHtmlNode *node, void *userdata) {
- auto *result_items = (std::vector<std::unique_ptr<BodyItem>>*)userdata;
+ auto *result_items = (BodyItems*)userdata;
const char *href = quickmedia_html_node_get_attribute_value(node, "href");
// TODO: Also add title for related media
if(href && begins_with(href, "/watch?v=")) {