1
votes

I'm trying to use the AlchemyAPI to run a sentiment analysis on a number of URLs. Because these URLs have their own set of parameters, I'm getting the data using HTTP.get, then running Alchemy's HTMLGetTextSentiment on the html that is returned:

getSentiment: (url) ->
    html = HTTP.get url

    res = HTTP.get "http://access.alchemyapi.com/calls/html/HTMLGetTextSentiment?html=#{html}&apikey=<key>&outputMode=json"
    res

This all works perfectly... Except half the time it thinks the content is the wrong language and throws an error. I happen to know that 100% of these pages will contain only English-language content, so is there a way to bypass the language detector and hard-code the language into the request?

1
Doesn't seem to be a Meteor question, mis-tagged?Michel Floyd
Sorry about that! It originally had more to do with Meteor, but I changed it.samcorcos

1 Answers

0
votes

I suggest you try the following:

res = HTTP.get "http://access.alchemyapi.com/calls/html/HTMLGetTextSentiment?html=#{html}&apikey=<key>&outputMode=json&language=english"

The language=english parameter addition is the important part.

A similar approach worked for me.