Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Instagramの猫画像クローラ crawl_instagram.cpp
#include <fstream>
#include <iostream>
#include <string>
#include <restclient-cpp/restclient.h>
#include "json11.hpp"
static std::string client_id = "クライアントID";
static std::string endpoint = "" + client_id;
int main()
auto res = RestClient::get(endpoint);
std::string err;
auto json = json11::Json::parse(res.body, err);
std::cout << err << std::endl;
return 1;
auto data = json["data"].array_items();
for(auto& item : data)
auto id = item["id"].string_value();
auto url = item["images"]["standard_resolution"]["url"].string_value();
std::cout << url << std::endl;
auto raw = RestClient::get(url);
std::ofstream out(id + ".jpg");
out << raw.body;
return 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.