使用twitCurl如何向twitter URL传递参数

使用twitCurl如何向twitter URL传递参数,twitter,Twitter,我需要访问twitterapi来完成一个快速的项目,我不希望在学习我认为是理想解决方案的API时被束缚 目前,我所需要做的就是为一个Twitter用户获取最新的信息,这可以很容易地做到,并且可以在交易中处理所有oAuth内容 但是我现在想在调用API时使用'since_id'参数。我看不出有什么办法可以做到这一点,事实上,似乎没有办法将参数传递给许多调用。我是否遗漏了一些东西,或者这是我严重缺少的东西 如果这是不可能的,那么有人可以建议推特和替代的C++包用于Twitter API。 谢谢阅读。

我需要访问twitterapi来完成一个快速的项目,我不希望在学习我认为是理想解决方案的API时被束缚

目前,我所需要做的就是为一个Twitter用户获取最新的信息,这可以很容易地做到,并且可以在交易中处理所有oAuth内容

但是我现在想在调用API时使用'since_id'参数。我看不出有什么办法可以做到这一点,事实上,似乎没有办法将参数传递给许多调用。我是否遗漏了一些东西,或者这是我严重缺少的东西

如果这是不可能的,那么有人可以建议推特和替代的C++包用于Twitter API。


谢谢阅读。

我不想回答我自己的问题,但我已经解决了,为了防止其他人有同样的问题,我将在这里记录

我修改了twitCurl代码,添加了一个额外的参数,一个表示'since_id'的字符串。这最终非常简单,我已经将更改提交给TwitchURL开发人员。如果您迫不及待,以下是我的更改差异:

Index: twitcurl.cpp =================================================================== --- twitcurl.cpp (revision 25) +++ twitcurl.cpp (working copy) @@ -474,19 +474,28 @@ * * @description: method to get mentions * -* @input: none +* @input: sinceId - since_id in string format * * @output: true if GET is success, otherwise false. This does not check http * response by twitter. Use getLastWebResponse() for that. * *--*/ -bool twitCurl::mentionsGet() +bool twitCurl::mentionsGet( std::string sinceId ) { bool retVal = false; if( isCurlInit() ) { + /* Prepare URL */ + std::string buildUrl( "" ); + buildUrl = twitterDefaults::TWITCURL_MENTIONS_URL; + if( sinceId.length() ) + { + buildUrl.append( twitCurlDefaults::TWITCURL_SINCEID.c_str() ); + buildUrl.append( sinceId.c_str() ); + } + /* Perform GET */ - retVal = performGet( twitterDefaults::TWITCURL_MENTIONS_URL ); + retVal = performGet( buildUrl ); } return retVal; } Index: twitcurl.h =================================================================== --- twitcurl.h (revision 25) +++ twitcurl.h (working copy) @@ -24,6 +24,7 @@ const std::string TWITCURL_EXTENSIONFORMAT = ".xml"; const std::string TWITCURL_TARGETSCREENNAME = "? target_screen_name="; const std::string TWITCURL_TARGETUSERID = "?target_id="; + const std::string TWITCURL_SINCEID = "?since_id="; }; /* Default twitter URLs */ @@ -123,7 +124,7 @@ bool timelineFriendsGet(); bool timelineUserGet( std::string userInfo = "" /* in */, bool isUserId = false /* in */ ); bool featuredUsersGet(); - bool mentionsGet(); + bool mentionsGet( std::string sinceId = "" ); /* Twitter user APIs */ bool userGet( std::string& userInfo /* in */, bool isUserId = false /* in */ ); 索引:twitcurl.cpp =================================================================== ---twitcurl.cpp(第25版) +++twitcurl.cpp(工作副本) @@ -474,19 +474,28 @@ * *@description:获得提名的方法 * -*@input:none +*@input:sinceId-sinceId,字符串格式 * *@output:GET成功为true,否则为false。这是不可能的 检查http *twitter的回应。使用getLastWebResponse()实现此目的。 * *--*/ -bool twitCurl::sinetingsget() +bool twitCurl::sinetingset(std::string sinceId) { bool-retVal=false; if(isCurlInit()) { +/*准备URL*/ +std::字符串buildUrl(“”); +buildUrl=twitterDefaults::TwitchURL\u提及\u URL; +if(sinceId.length()) + { + append(twitCurlDefaults::TWITCURL_SINCEID.c_str()); +append(sinceId.c_str()); + } + /*执行GET*/ -retVal= performGet(twitterDefaults::TwitchURL\u提及\u URL); +retVal=performGet(buildUrl); } 返回返回; } 索引:twitcurl.h =================================================================== ---twitcurl.h(第25版) +++twitcurl.h(工作副本) @@ -24,6 +24,7 @@ const std::string TWITCURL_EXTENSIONFORMAT=“.xml”; const std::string TWITCURL_TARGETSCREENNAME=“? target_screen_name=“; const std::string TWITCURL_TARGETUSERID=“?target_id=”; +const std::string TWITCURL_SINCEID=“?自_id=”; }; /*默认twitter URL*/ @@ -123,7 +124,7 @@ bool timelineFriendsGet(); bool timelineUserGet(std::string userInfo=”“/*in*/,bool isUserId=false/*in*/); bool featuredUsersGet(); -bool-signesget(); +bool-sinceId=“”); /*Twitter用户API*/ bool userGet(std::string&userInfo/*in*/,bool isUserId= 在*/)中为假/*;