{"id":21889105,"url":"https://github.com/neko-life/nekos-bestpp","last_synced_at":"2026-04-15T06:34:48.251Z","repository":{"id":115954782,"uuid":"568337371","full_name":"Neko-Life/nekos-bestpp","owner":"Neko-Life","description":"C++ API wrapper for nekos.best","archived":false,"fork":false,"pushed_at":"2023-10-29T16:31:43.000Z","size":182,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-26T20:32:52.409Z","etag":null,"topics":["api","api-wrapper","cpp","cpp17","http","http-client","library","nekos-best"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Neko-Life.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-11-20T07:48:39.000Z","updated_at":"2022-12-20T01:06:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"f1f9f16b-7d58-4c76-9e96-0e197f19c834","html_url":"https://github.com/Neko-Life/nekos-bestpp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neko-Life%2Fnekos-bestpp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neko-Life%2Fnekos-bestpp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neko-Life%2Fnekos-bestpp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Neko-Life%2Fnekos-bestpp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Neko-Life","download_url":"https://codeload.github.com/Neko-Life/nekos-bestpp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244895792,"owners_count":20527941,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","api-wrapper","cpp","cpp17","http","http-client","library","nekos-best"],"created_at":"2024-11-28T11:19:28.633Z","updated_at":"2026-04-15T06:34:43.205Z","avatar_url":"https://github.com/Neko-Life.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# nekos-best++\nC++ API wrapper for [nekos.best](https://nekos.best/),\n[API Documentation](https://docs.nekos.best/).\n\n## Dependencies\n- [curlpp](https://github.com/jpbarrette/curlpp/)\n- libcurl\n- [nlohmann/json](https://github.com/nlohmann/json) (included)\n\n## Usage\n\nVery simple to use and straightforward:\n\n```cpp\n#include \u003cstdio.h\u003e\n#include \"nekos-best++.hpp\"\n\nint main() {\n\t// init the client first to cache all available endpoints for it to be able to get random endpoint\n\tnekos_best::init();\n\n\tprintf(\"base_url: %s\\n\", nekos_best::get_base_url().c_str());\n\tnekos_best::QueryResult result_struct = nekos_best::fetch(\"\", 5);\n\n\t// check the response\n\tconst nekos_best::Response res = nekos_best::get_last_request_response();\n\n\tprintf(\"[RESPONSE] STATUS_CODE: %ld\\n\", res.status_code);\n\tprintf(\"[RESPONSE] HEADERS:\\n\");\n\n\tfor (const auto header : res.headers)\n\t\tprintf(\"\\\"%s\\\": \\\"%s\\\"\\n\", header.first.c_str(), header.second.c_str());\n\n\tprintf(\"\\n\");\n\n\tprintf(\"[RESPONSE] JSON:\\n%s\\n\\n\", res.raw_json.dump(2).c_str());\n\tfor (const nekos_best::Meta\u0026 data : result_struct.results) {\n\t\tprintf(\"Got url: %s\\n\", data.url.c_str());\n\t}\n\n\treturn 0;\n}\n```\n\nGet a list of available endpoints:\n\n```cpp\n#include \u003cstdio.h\u003e\n#include \"nekos-best++.hpp\"\n\nint main() {\n\tprintf(\"%s\\n\", nekos_best::get_base_url().c_str());\n\n\t// as we call get_available_endpoints() here thus caching the endpoints data from the API,\n\t// we don't need to initialize the client anymore.\n\tconst std::map\u003cstd::string, nekos_best::EndpointSpec\u003e res = nekos_best::get_available_endpoints();\n\n\tfor (const auto\u0026 d : res) {\n\t\tprintf(\"KEY: \\\"%s\\\"\\n\", d.first.c_str());\n\n\t\tprintf(\"FORMAT: \\\"%s\\\"\\n\", nekos_best::get_str_format(d.second.format).c_str());\n\t\tprintf(\"MAX: \\\"%s\\\"\\n\", d.second.max.c_str());\n\t\tprintf(\"MIN: \\\"%s\\\"\\n\", d.second.min.c_str());\n\t\tprintf(\"NAME: \\\"%s\\\"\\n\", d.second.name.c_str());\n\t\tprintf(\"\\n\");\n\t}\n\n\treturn 0;\n}\n```\n\nDownloading:\n\n```cpp\nconst std::string search_result = \"https://nekos.best/api/v2/neko/c841bace-142f-41ee-a042-666b1bb4554a.png\";\n\nstd::ostringstream download_stream;\n// \t\t\t\t\tdownload search result\nnekos_best::Meta meta = nekos_best::download(search_result, \u0026download_stream);\n\nstd::ofstream file;\n\n// no image info from the API, we can just name it this for now\n// or better specify endpoint you know which gives which\n// and have a proper filename with an extension\nfile.open(\"image\", std::ios::out);\n\nif (!file.is_open()) {\n\tfprintf(stderr, \"[download ERROR] Can't open stream for writing\\n\");\n}\nelse {\n\t// get header size\n\tconst auto response = nekos_best::get_last_request_response();\n\t// \t\tstrip header from actual image data\n\tfile \u003c\u003c download_stream.str().substr(response.header_size);\n\tfile.close();\n\tprintf(\"Image saved to \\'image\\'\\n\");\n}\n```\n\nRecommended to check for last response result after every fetch by calling get_last_request_response(),\nhelps to determine whether a request failed or succeeded.\n\nYou can check whether you're rate limited from making any more request to an endpoint with the is_rate_limited() function.\nGet the RateLimitInfo struct of an endpoint by calling get_rate_limit_info().\n\nEvery request is blocking, you can simply use thread if you like. Use the ns_mutex mutex for thread safety.\n\nRead and compile example files for demonstration.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneko-life%2Fnekos-bestpp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fneko-life%2Fnekos-bestpp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fneko-life%2Fnekos-bestpp/lists"}