Something went wrong. Try again.
Something went wrong. Try again.
GithubActive main.cpp
12345678910111213141516171819202122232425262728#define CPPHTTPLIB_OPENSSL_SUPPORT#include <iostream>#include "httplib/httplib.h"#include "json/include/nlohmann/json.hpp"
int main() { std::string usr; std::cout << "Github Username: "; std::cin >> usr;
httplib::Client cli("https://api.github.com"); if (auto response = cli.Get("/users/" + usr +"/events", httplib::Headers{{"User-Agent", "higithub"}})) { nlohmann::json datas = nlohmann::json::parse(response->body);
std::cout << "Checking for " << usr << std::endl;
for (const auto& data : datas){ std::string type = data["type"]; std::string repo = data["repo"]["name"]; std::string date = data["created_at"];
std::cout << "[" << date << "] " << type << " -> " << repo << std::endl; } } else { std::cout << "Request didnt work :(" << std::endl; } return 0;}