about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp12
1 files changed, 7 insertions, 5 deletions
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 <cpr/cpr.h>
 #include <nlohmann/json.hpp>
+#include <sqlite3.h>
 #include <string>
 #include <iostream>
 #include <exception>
@@ -48,7 +49,7 @@ vector<string> getInstances() {
 
     vector<string> 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<string> 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<string> getInstances() {
 
 int main() {
 
-    cout << renderSearchBar() << endl;
+    // cout << renderSearchBar() << endl;
     vector<string> instances = getInstances();
     for (auto i: instances) {
         cout << i << " ";