about summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorComradeCrow <comradecrow@vivaldi.net>2023-04-01 01:48:32 -0700
committerComradeCrow <comradecrow@vivaldi.net>2023-04-01 01:48:32 -0700
commit1082974bf046a94b4a52df6e8b3b3649a5bb85d6 (patch)
tree61b9c5e1271280405c72f0526e300d5a8c4e0783 /src
parent6cbff5d60cb708eb7f1eb0a598a6bb99d4b3a9e7 (diff)
downloadytcpp-1082974bf046a94b4a52df6e8b3b3649a5bb85d6.tar.gz
minor update
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 << " ";