使用RapidMiner提取Twitter - 超越有限的"搜索Twitter"操作者

时间:2017-07-16 09:15:30

标签: twitter rapidminer

我已经在Twitter Dev中拥有一个帐户,这允许我获得一个消费者密钥和秘密,我用它来生成我的令牌。现在,我正在尝试使用运算符" Get Page",#34; Jason to XML"和#34;写文件"。但是,我不知道在" Get Page"运营商。是请求令牌URL授权URL还是访问令牌URL?

2 个答案:

答案 0 :(得分:1)

In general the request URL contains the REST API call, while you are providing your authorization credentials e.g. via request properties in the HTTP header, OAuth mechanisms and the like. An REST API call is build up on a base URL awaiting a call, in case of twitter https://api.twitter.com/1.1/search/tweets.json, combined with a state and HTTP options forming your request. If your searching for tweets from a given user account (like @twitterapi) your request URL part would look like q=%40twitterapi. Here a key q is given with the value %40twitterapi, where %40 is a representation of the '@' symbol.

Providing key-value-pairs via GET using the HTTP protocol is initialized with a leading '?'. Hence your REST request would look like this: https://api.twitter.com/1.1/search/tweets.json?q=%40twitterapi. This example is taken from the Twitter documentation.

That's about the URL.

For the RapidMiner site, I'd try to use the Enrich Data by Webservice operator. You can fill in the url parameter with your request URL and set the HTTP header for using an authentication token using the request properties parameter. As a property use Authorization and for the value you use a string starting with Bearer followed by your token. So a potential value could be Bearer 943582034-IH3k6hlskfdj32l4hks.

You can choose betweent different query types (e.g., String Matching, Regular Expression and others) to define the handling of the received payload given as an response to your request.

Before playing around with the operator, you can try using a tool like Postman (Chrome Plugin) or HTTPrequester (Firefox Add-on) to work directly with the HTTP GET request and its response.

Sorry for not including more references, but Stackoverflow doesn't allow for more than two if your reputation is below 10...

答案 1 :(得分:1)

我同意上述内容 - 通过Webservice运算符使用Enrich Data。您需要下载Web Mining extension才能看到它。如果您在RapidMiner user community forum上重新发帖,您也可以获得更多针对RapidMiner的帮助。