diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/Manganelo.cpp | 2 | ||||
-rw-r--r-- | src/plugins/Plugin.cpp | 4 | ||||
-rw-r--r-- | src/plugins/Youtube.cpp | 3 |
3 files changed, 5 insertions, 4 deletions
diff --git a/src/plugins/Manganelo.cpp b/src/plugins/Manganelo.cpp index b1f02a3..e91baf0 100644 --- a/src/plugins/Manganelo.cpp +++ b/src/plugins/Manganelo.cpp @@ -67,7 +67,7 @@ namespace QuickMedia { Json::CharReaderBuilder json_builder; std::unique_ptr<Json::CharReader> json_reader(json_builder.newCharReader()); std::string json_errors; - if(json_reader->parse(&server_response.front(), &server_response.back(), &json_root, &json_errors)) { + if(!json_reader->parse(&server_response[0], &server_response[server_response.size()], &json_root, &json_errors)) { fprintf(stderr, "Manganelo suggestions json error: %s\n", json_errors.c_str()); return SuggestionResult::ERR; } diff --git a/src/plugins/Plugin.cpp b/src/plugins/Plugin.cpp index 86f5d7d..5d81aad 100644 --- a/src/plugins/Plugin.cpp +++ b/src/plugins/Plugin.cpp @@ -28,11 +28,13 @@ namespace QuickMedia { } DownloadResult download_to_string(const std::string &url, std::string &result, const std::vector<CommandArg> &additional_args) { - std::vector<const char*> args = { "curl", "-H", "Accept-Language: en-US,en;q=0.5", "--compressed", "-s", "-L", url.c_str() }; + std::vector<const char*> args = { "curl", "-H", "Accept-Language: en-US,en;q=0.5", "--compressed", "-s", "-L" }; for(const CommandArg &arg : additional_args) { args.push_back(arg.option.c_str()); args.push_back(arg.value.c_str()); } + args.push_back("--"); + args.push_back(url.c_str()); args.push_back(nullptr); if(exec_program(args.data(), accumulate_string, &result) != 0) return DownloadResult::NET_ERR; diff --git a/src/plugins/Youtube.cpp b/src/plugins/Youtube.cpp index a5670ec..2a3f011 100644 --- a/src/plugins/Youtube.cpp +++ b/src/plugins/Youtube.cpp @@ -48,13 +48,12 @@ namespace QuickMedia { if(json_end == 0 || json_start >= json_end) return SuggestionResult::ERR; - --json_end; Json::Value json_root; Json::CharReaderBuilder json_builder; std::unique_ptr<Json::CharReader> json_reader(json_builder.newCharReader()); std::string json_errors; - if(json_reader->parse(&server_response[json_start], &server_response[json_end], &json_root, &json_errors)) { + if(!json_reader->parse(&server_response[json_start], &server_response[json_end], &json_root, &json_errors)) { fprintf(stderr, "Youtube suggestions json error: %s\n", json_errors.c_str()); return SuggestionResult::ERR; } |