From 1082974bf046a94b4a52df6e8b3b3649a5bb85d6 Mon Sep 17 00:00:00 2001 From: ComradeCrow Date: Sat, 1 Apr 2023 01:48:32 -0700 Subject: minor update --- src/main.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index 923f30f..fc5c887 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -48,7 +49,7 @@ vector getInstances() { vector result; cpr::Response r = cpr::Get(cpr::Url{"https://api.invidious.io/instances.json"}, - cpr::Parameters{{"sort_by", "api"}}); + cpr::Parameters{{"sort_by", "health"}}); if (r.status_code > 299) { @@ -57,9 +58,10 @@ vector getInstances() { } json j = json::parse(r.text); - for (json i: j) { - if (i[1]["api"]) { - result.push_back(i.front()); + for ( json i: j ) { + if ( i[1]["api"] != json::value_t::null && i[1]["api"]) { + + result.push_back( i[1]["uri"] ); } } return result; @@ -67,7 +69,7 @@ vector getInstances() { int main() { - cout << renderSearchBar() << endl; + // cout << renderSearchBar() << endl; vector instances = getInstances(); for (auto i: instances) { cout << i << " "; -- cgit 1.4.1-2-gfad0