From e247f53f5f7c7843afc5c269163b3446967b49eb Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 20 Aug 2016 14:08:37 -0400 Subject: Updated libtwitter++ through librawr (API changes) --- sap.cpp | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'sap.cpp') diff --git a/sap.cpp b/sap.cpp index 4e2f66c..56fb677 100644 --- a/sap.cpp +++ b/sap.cpp @@ -18,6 +18,13 @@ extern "C" { #include #include +/* - random frames from Spongebob (using ffmpeg) + * with strange text overlaid, possibly rawr'd from + * spongebob transcripts combined with drug trip + * experiences? either that or something with verb + * frames + */ + template Container split(std::string input, std::string delimiter) { @@ -442,25 +449,16 @@ int main(int argc, char** argv) std::cout << "Generated image." << std::endl << "Tweeting..." << std::endl; - long media_id; - twitter::response resp = client.uploadMedia("image/jpeg", (const char*) outputimg.data(), outputimg.length(), media_id); - if (resp != twitter::response::ok) + try { - std::cout << "Twitter error while uploading image: " << resp << std::endl; - - break; - } + long media_id = client.uploadMedia("image/jpeg", (const char*) outputimg.data(), outputimg.length()); + client.updateStatus("", {media_id}); - twitter::tweet tw; - resp = client.updateStatus("", tw, twitter::tweet(), {media_id}); - if (resp != twitter::response::ok) + std::cout << "Done!" << std::endl << "Waiting..." << std::endl << std::endl; + } catch (const twitter::twitter_error& error) { - std::cout << "Twitter error while tweeting: " << resp << std::endl; - - break; + std::cout << "Twitter error: " << error.what() << std::endl; } - - std::cout << "Done!" << std::endl << "Waiting..." << std::endl << std::endl; break; } -- cgit 1.4.1