plasticuproject / cleverbotfree

Free alternative for the Cleverbot API
GNU General Public License v3.0
58 stars 6 forks source link

not working #20

Closed bakarali64 closed 3 years ago

bakarali64 commented 3 years ago
bot = c_b.single_exchange(user_input)
plasticuproject commented 3 years ago

It's working in playwright debug/headed mode, but it's not loading the needed javascript for the cleverbot.sendAI() call when run headless and I'm not sure why. If anyone has an idea or a fix drop it here or issue a PR.

GitHubEmploy commented 3 years ago

How do you set playwright into headless mode?

GitHubEmploy commented 3 years ago

Update:

Screen Shot 2021-10-20 at 9 21 33 PM

There's a warning you have to click before you can start using it

plasticuproject commented 3 years ago

It is run in in headless mode by default. To change to headed mode change the line self.p_w.firefox.launch() to self.p_w.firefox.launch(headless=False) Or if you want to use debug mode install chromium binary playwright install chromium and change to self.p_w.chromium.launch() then run with PWDEBUG=1

plasticuproject commented 3 years ago

Update: Screen Shot 2021-10-20 at 9 21 33 PM

There's a warning you have to click before you can start using it

That's always been there and I've never had to automate that click before, it would still load the needed JavaScript function, and still does in headed mode. Pretty sure a click is not needed still.

plasticuproject commented 3 years ago

Feel free to play around in headed/debug mode and see if you can figure it out. I know they are taking measures to break these unauthorized wrappers and automated tools as it's cutting into their API subscription revenue 🤷 . I've seen them personally comment on libraries like this one.

GitHubEmploy commented 3 years ago

Also, its giving me this error:

Screen Shot 2021-10-21 at 7 46 03 PM

If I dont click the message. Any way to fix this? Also, the accept can be done by executing the noteok() function in console:

Screen Shot 2021-10-21 at 7 47 19 PM

If you can do this through playwright, this would probably work.

Also, is there any way to do this through selenium?

plasticuproject commented 3 years ago

I already explained that you don't need to click that to load the JS script and call the function, that's not the issue: cb

Also, is there any way to do this through selenium?

I used selenium in the version 1.x, it worked for a long time but they started detecting it so I re-wrote it to use playwright. Take a look at the closed issue #15 and you will see.

GitHubEmploy commented 3 years ago

Is it okay if you can give me the old selenium version of that code? Just curious on how you implemented it.

plasticuproject commented 3 years ago

https://github.com/plasticuproject/cleverbotfree/blob/1e4b0056c255d810abecd672aff7a9c37308d238/cleverbotfree/cbfree.py

GitHubEmploy commented 3 years ago

Ah. Is it okay if you could make a google collab or replit so we can have the same env when working so we can see if that is causing the error.