pierredavidbelanger / chatter-bot-api

A Mono/.NET, JAVA, Python and PHP chatter bot API that supports Cleverbot, JabberWacky and Pandorabots.
181 stars 72 forks source link

All versions failed suddenly #26

Closed fanshi14 closed 8 years ago

fanshi14 commented 8 years ago

Hi all,

In the old days, it worked very very well but since yesterday it seemed that every version failed. As Python version an example, the output will be:

D:\Projects\chatter-bot-api-master\python>python chatterbotapitest.py
bot1> Hi
bot2> Hi there! What is your name?
Traceback (most recent call last):
  File "chatterbotapitest.py", line 37, in <module>
    s = bot1session.think(s);
  File "D:\Projects\5.7\chatter-bot-api-master\python\chatterbotapi.py", line 72, in think
    return self.think_thought(thought).text
  File "D:\Projects\5.7\chatter-bot-api-master\python\chatterbotapi.py", line 113, in think_thought
    url_response = self.opener.open(self.bot.serviceUrl, data.encode('utf-8'))
  File "D:\Python27\lib\urllib2.py", line 437, in open
    response = meth(req, response)
  File "D:\Python27\lib\urllib2.py", line 550, in http_response
    'http', request, response, code, msg, hdrs)
  File "D:\Python27\lib\urllib2.py", line 475, in error
    return self._call_chain(*args)
  File "D:\Python27\lib\urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "D:\Python27\lib\urllib2.py", line 558, in http_error_default
    raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 400: BAD REQUEST

Could anyone help me solve this?

Thanks in advance!

Kahn

fanshi14 commented 8 years ago

And I tried 3 different PC, so seems not the problem of my IP address.

ghost commented 8 years ago

Hi, im actually getting an 404 error too. I think they changed their API again.

Btw: I am using the java implemention.

(I have tried it from my Server and home connection, same result, so it cannot be an ip ban)

teamupwithteamup commented 8 years ago

Failed for me as well, but pandorabots still works. Using java, JabberWacky give me this if(ob== null||cc==0) return true;if(cc==13||cc==3){uniEsc1();ob.form.submit()};return true;} and clever bot gives nothing

lesmo commented 8 years ago

I can confirm this happens too on PHP version.

Enaero commented 8 years ago

Happening to me too using Java version. Most likely cleverbot api changed, the service call looks like this now: http://www.cleverbot.com/webservicemin?out=&in=Hi.&bot=c&cbsid=WXJ29F75UF&xai=WXJ&ns=1&al=&dl=&flag=&user=&mode=1&

-The thing that's breaking is this: cbsid=WXJ29F75UF It is missing from this lib, and when you take it out of the url it sends back 404.

EDIT: Actually looking at the request more closely it still seems to follow the format that the code uses. Maybe it's something with the headers/cookie?

pedroslopez commented 8 years ago

Same story with the .NET version.

lesmo commented 8 years ago

I'm quite confident it has something to do with the cookies. I've copied the URI Cleverbot uses to get responses, and the same story happens.

I've found this link, though. I'm working on figuring out how to use it, perhaps it can be adapted into the current code: http://www.cleverscript.com/demos/clever-data-demo

It uses a different communication strategy. It returns JSONP.

Enaero commented 8 years ago

What about https://cleverbot.io/ ? It seems like a good replacement and was built for handling external requests. Although I'm not sure how good it is at holding a conversation, the "Try it now" experience for me was pretty much just it saying random phrases back at me.

ghost commented 8 years ago

As far as I know the APP for Android was always reverse engineered and then we built the API here.

ijat commented 8 years ago

API changed. Got bad request from Cleverbot.

lesmo commented 8 years ago

@Enaero I checked that, but cleverbot.io, just as you said, isn't as good. Also, it doesn't support other languages like Cleverbot does (which is kind of important for me).

@BlueFreakLP I didn't know that... to me it looked like it was reversed engineered from the web version.

ghost commented 8 years ago

CleverBot has just a big database with answers. Someone need to take time and fix it, this will take here some days or more. I just cant recommed to use the project for serious things, cause cleverbot is changing the API too often

m10653 commented 8 years ago

Same problem, I am getting HTTP response code: 400 when I try to use the api.

kodyvoyles commented 8 years ago

Still works with PandoraBox

pierredavidbelanger commented 8 years ago

Seems like they changed the CleverBot code again.

Thanks for the python stack @KahnShi .

Thank for the hint @Enaero .

@lesmo I think this is just a demo page for their commercial integration.

Also, as @BlueFreakLP pointed out, this project should not be used for serious / production things. Indeed, my CleverBot integration is a kind of unofficial (and unapproved to some extent) reverse engineered hack to call their web site, as they do not have a proper free API.

Anyways, I will have a look at this soon.

Thank you for your patience.

pierredavidbelanger commented 8 years ago

Ok, it seems to be fixed now. But this really smells like it will break again soon.

In the PHP port, I fixed only the chatterbotapi.php.

The fixed Python port is here.

The fixed .NET/Mono port is also fixed. But, please, note that I only tried it on:

$ mono --version
Mono JIT compiler version 4.0.5 ((detached/1d8d582 Tue Oct 20 15:15:33 EDT 2015)
$ uname -v
Darwin Kernel Version 15.4.0: Fri Feb 26 22:08:05 PST 2016; root:xnu-3248.40.184~3/RELEASE_X86_64

For the Java port, I made a SNAPSHOT release, so, for Maven users, use the sonatype repository:

<repositories>
    <repository>
        <id>oss.sonatype.org</id>
        <url>https://oss.sonatype.org/content/repositories/snapshots</url>
        <releases><enabled>false</enabled></releases>
        <snapshots><enabled>true</enabled></snapshots>
    </repository>
</repositories>
latifoz commented 8 years ago

Using PHP, the session is not preserved. Normally the session id comes in header as CBCONVID parameter and then it is set as a cookie (CBSID). It seems there are other cookie parameters set by JS to make the session work.