zoukankan      html  css  js  c++  java
  • Simsimi 小黄鸡机器人最新无限制接口api simsimi机器人接口api 微信公众号

    一、什么是Simsimi?

    simsimi公司是提供智能服务,其中一个服务是simsimi聊天机器人服务,每天有超过百万的用户聊天,国内最大的搜索引擎——百度的产品siri使用的就是simsimi提供的api。

    你可以在网址http://www.simsimi.com/talk.htm# 进行体验

    SimSimi inc. is specialized in collective intelligence service. All kinds of services we provide generates unique entertainment and values through systemized collective intelligence.

    One of our services, a chatting robot SimSimi exceeds the limitation of technology of natural-language processing system by collective intelligence and it has a chat with over millions user per day. Our Premium knowledge providing service “Jisikman” creates millions of valuable knowledges a day.

    We invite you to our realm of service which is available through our cloud of collective intelligence, Crowd Cloud that SimSimi inc. creates.

    二、Simsimi小黄鸡API

    在 去年的这个时候,小黄鸡的非官方api一度被大家疯狂的在微信公众号上使用,一时间不知道成就了多少微信营销号,同时,华科某位大四学生利用这个api, 结合人人网开发平台,制作了一个小黄鸡的人人号,@小黄鸡之后,就可以利用api自动进行回复,是的这个人人号瞬间粉丝陡增。

    然而大家使用的都是非官方的API,所谓非官方,就是不是simsimi公司提供的合法使用途径,API大致的原理是利用编程语言,模拟浏览器发送post请求到http://www.simsimi.com/talk.htm# 链 接,解析响应,然后作成相关的小黄鸡API。这个方法后来被我在本博客中在博文中发布,导致使用人数激增,simsimi公司似乎察觉了什么,立马对这种 模拟请求的方式做出了屏蔽,一旦某ip请求数量和频率超过限制,则终端对它的请求。正式官方对非法API的封锁,也使用国内的开发这关注到之前并不出名的 小i机器人,同样使用语言模拟请求web聊天界面,时间没有过很久,这个页面就加入了图片验证码防止程序模拟。

    至此,两个聊天机器人都走上了收费的道路...准确的说,应该是被这帮子开发者赶上了收费的道路,因为他们给它带来了知名度。

    三、SimsimiAPI使用

    目前,小黄鸡API已经公然收费(http://developer.simsimi.com/api)

    不过,和之前一样,会给注册用户提供30天的试用API。

    API请求链接为:

    Trial-key    http://sandbox.api.simsimi.com/request.p

    Paid-key    http://api.simsimi.com/request.p

    API请求参数为:

    ParameterValueRequiredDefaultDescription
    key String Y   Your key value
    text String Y   Query message
    lc String Y   Language code(List)
    ft Double(0.0 ~ 1.0)   0.0 可以设置一个过滤器
    0.0:未过滤(包含诅咒,性内容)
    1.0:过滤不文明字句(暂时只支持韩文)
    过滤内容,请访问下面的网站。 
    https://www.webpurify.com/

    API返回格式为:

    result:100-ok. 400-Bad Request. 401-Unauthorized. 404-Not found. 500-Server Error.    返回的code

    id:Response id. (you can get only if returning result is 100)回复的id,由系统生成,当请求成功返回时才有这个字段。 

    response:Response message(you can get only if returning result is 100)返回的回复内容。

    msg:Result  msg(Description of result code) 返回的code对应的含义

    四、Simsimi使用举例

    请求举例:

    Trial-key    http://sandbox.api.simsimi.com/request.p?key=your_trial_key&lc=en&ft=1.0&text=hi    

    Paid-key    http://api.simsimi.com/request.p?key=your_paid_key&lc=en&ft=1.0&text=hi

    响应举例:

    { "result": 100, "response": "Who are you?!", "id": 13185569, "msg": "OK." }

    五、如何免费的使用Simsimi API

    我想,大家都懂了,写这篇文章的原因就是很多人搜索小黄鸡 api到我的博客,我想大家都是要找免费的小黄鸡API。这里提供给大家一个思路:

    合作伙伴中,有人人网,为什么?本博文前面提高某大四学生做了一个人人号,@小黄鸡之后,会自动进行回复,他使用的就是simsimi的官方正版付费API,既然人人网提供开发平台,可以对帐号进行回复,获得回复等等操作,为什么不能使用程序,登录帐号,然后@小黄鸡,然后获得它的回复,再返回给你自己的用户呢?答案当然是可以的!!!

    下面贴出一段可供参考的Java代码,之所以为仅供参考,就是说只能参考思路,代码运行是运行不起来的!!!

    如果能够帮助到你,希望回复点评一下,你懂的...

     
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    import java.o.IOException;
    import java.util.ArrayList;
    import java.util.List;
    import java.util.Scanner;
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
    import org.apache.http.Header;
    import org.apache.http.HttpResponse;
    import org.apache.http.NameValuePair;
    import org.apache.http.client.ClientProtocolException;
    import org.apache.http.client.ResponseHandler;
    import org.apache.http.client.entity.UrlEncodedFormEntity;
    import org.apache.http.client.methods.HttpGet;
    import org.apache.http.client.methods.HttpPost;
    import org.apache.http.impl.client.BasicResponseHandler;
    import org.apache.http.impl.client.DefaultHttpClient;
    import org.apache.http.message.BasicNameValuePair;
    import org.apache.http.protocol.HTTP;
    import org.apache.http.util.EntityUtils;
    /**
     * 利用httpclient操作人人网 比如登陆,发状态,模拟你访问任何人主页等等
     * @author: http://50vip.com
     
     */
    public class RenRen {
        private String userName = "";
        private String password = "";
         
        private static String redirectURL = "http://www.renren.com/home";
        private static String renRenLoginURL = "http://www.renren.com/PLogin.do";
        private static String talkUrl = "http://photo.renren.com/photo/simsimiWebPagerChat";
        private HttpResponse response;
        private DefaultHttpClient httpclient = null;
        private String requestToken = null;
        private String _rtk = null;
         
        public RenRen(String userName, String password) {
            this.userName = userName;
            this.password = password;
        }
         
        public static void main(String[] args) {
            RenRen rr = null;
            rr = new RenRen("xxxxx@hotmail.com""yyyyy");
            rr.login();
            System.out.println(rr.talk("820"));
        }
        /**
         * 登陆
         * @author: http://50vip.com
         * @return
         */
        public boolean login() {
            if (httpclient != null) {
                return true;
            }
            httpclient = null;
            httpclient = new DefaultHttpClient();
            HttpPost httpost = new HttpPost(renRenLoginURL);
            // All the parameters post to the web site
            List<NameValuePair> nvps = new ArrayList<NameValuePair>();
            nvps.add(new BasicNameValuePair("origURL", redirectURL));
            nvps.add(new BasicNameValuePair("domain""renren.com"));
            nvps.add(new BasicNameValuePair("autoLogin""true"));
            nvps.add(new BasicNameValuePair("formName"""));
            nvps.add(new BasicNameValuePair("method"""));
            nvps.add(new BasicNameValuePair("submit""登录"));
            nvps.add(new BasicNameValuePair("email", userName));
            nvps.add(new BasicNameValuePair("password", password));
            try {
                httpost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
                response = httpclient.execute(httpost);
                //System.out.println(response);
                catch (Exception e) {
                e.printStackTrace();
                return false;
            finally {
                httpost.abort();
            }
             
            String redirectLocation = getRedirectLocation();
            if (redirectLocation != null) {
                // 跳到首页,登录完成
                String indexHtml=getText(redirectLocation);
                 
                //获取requestToken get_check:'-2062261917'
                Pattern pattern1 = Pattern.compile("get_check:'(.*)',get_check_x");
                Matcher m1 = pattern1.matcher(indexHtml);
                if (m1.find()) {
                requestToken=m1.group(1);
                else {
                System.out.println("获取requestToken失败!");
                }
                 
                //"获取_rtk失败!"get_check_x:'50d55fbd'
                Pattern pattern2 = Pattern.compile("get_check_x:'(.*)',env:");
                Matcher m2 = pattern2.matcher(indexHtml);
                if (m2.find()) {
                    _rtk=m2.group(1);
                else {
                    System.out.println("获取_rtk失败!");
                }
            }
            return true;
        }
         
        /**
         * 和人人的小黄鸡交谈
         * @author: http://50vip.com
         * @param msg
         * @return
         */
        public String talk(String msg) {
            String repMsg="";//小黄的回复
             
            HttpPost httpost = new HttpPost(talkUrl);
            // All the parameters post to the web site
            List<NameValuePair> nvps = new ArrayList<NameValuePair>();
            nvps.add(new BasicNameValuePair("_rtk", _rtk));
            nvps.add(new BasicNameValuePair("requestToken", requestToken));
            nvps.add(new BasicNameValuePair("message", msg));
             
            try {
                ResponseHandler<String> responseHandler = new BasicResponseHandler();
                httpost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));
                repMsg=httpclient.execute(httpost, responseHandler);
            catch (Exception e) {
                e.printStackTrace();
            finally {
                httpost.abort();
            }
            return repMsg;
        }
         
        /**
         * 此处人人网会302跳转
         * @author: http://50vip.com
         * @return
         */
        private String getRedirectLocation() {
            Header locationHeader = response.getFirstHeader("Location");
            if (locationHeader == null) {
                return null;
            }
            return locationHeader.getValue();
        }
         
        /**
         * 读取首页内容
         * @author: http://50vip.com
         * @param redirectLocation
         * @return
         */
        private String getText(String redirectLocation) {
            HttpGet httpget = new HttpGet(redirectLocation);
            // Create a response handler
            ResponseHandler<String> responseHandler = new BasicResponseHandler();
            String responseBody = "";
            try {
                responseBody = httpclient.execute(httpget, responseHandler);
            catch (Exception e) {
                e.printStackTrace();
                responseBody = null;
            finally {
                httpget.abort();
            }
            return responseBody;
        }
    }
  • 相关阅读:
    朴素贝叶斯分类器实现
    Puppeteer使用
    神经网络常用名词
    Mysql binlog的基本使用和数据库恢复步骤
    webpack之代码分割及页面缓存优化
    webpack之常用loader的配置和使用
    webpack之常用plugin的配置和使用
    第11章 面向对象
    第10章 面向对象
    第9章 模块与包
  • 原文地址:https://www.cnblogs.com/SlashOut/p/4813809.html
Copyright © 2011-2022 走看看