0

我正在尝试在 R 中使用 Viral Heat API 进行情绪分析。使用 URL 直接点击浏览器会返回正确的结果。 http://www.viralheat.com/api/sentiment/review.json?text=我很高兴&api_key=

结果:{"prob":0.6652067715019936,"mood":"positive","text":"i am happy"}

但是当从 R 运行时,它返回 NULL

代码:

vh_answer = getURL("http://www.viralheat.com/api/sentiment/review.json?text=i%20am%20happy&api_key=<my key>")

是什么原因?有人可以帮忙吗?

4

1 回答 1

0

Try putting a followlocation = TRUE in your getURL call.

I suspect you may also need to use cainfo = system.file("CurlSSL", "cacert.pem", package = "RCurl")), as well.

于 2013-05-24T06:52:57.537 回答