diff options
Diffstat (limited to 'src/client.cpp')
| -rw-r--r-- | src/client.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
| diff --git a/src/client.cpp b/src/client.cpp index b7eb9d1..0a4cf2a 100644 --- a/src/client.cpp +++ b/src/client.cpp | |||
| @@ -351,4 +351,37 @@ namespace twitter { | |||
| 351 | return *_configuration; | 351 | return *_configuration; |
| 352 | } | 352 | } |
| 353 | 353 | ||
| 354 | std::list<tweet> client::hydrateTweets(std::set<tweet_id> ids) const | ||
| 355 | { | ||
| 356 | std::list<tweet> result; | ||
| 357 | |||
| 358 | while (!ids.empty()) | ||
| 359 | { | ||
| 360 | std::set<tweet_id> cur; | ||
| 361 | |||
| 362 | for (int i = 0; i < 100 && !ids.empty(); i++) | ||
| 363 | { | ||
| 364 | cur.insert(*std::begin(ids)); | ||
| 365 | ids.erase(std::begin(ids)); | ||
| 366 | } | ||
| 367 | |||
| 368 | std::string datastr = "id=" + | ||
| 369 | OAuth::PercentEncode(implode(std::begin(cur), std::end(cur), ",")); | ||
| 370 | |||
| 371 | std::string response = | ||
| 372 | post(auth_, | ||
| 373 | "https://api.twitter.com/1.1/statuses/lookup.json", | ||
| 374 | datastr).perform(); | ||
| 375 | |||
| 376 | nlohmann::json rjs = nlohmann::json::parse(response); | ||
| 377 | |||
| 378 | for (auto& single : rjs) | ||
| 379 | { | ||
| 380 | result.emplace_back(single.dump()); | ||
| 381 | } | ||
| 382 | } | ||
| 383 | |||
| 384 | return result; | ||
| 385 | } | ||
| 386 | |||
| 354 | }; | 387 | }; |
