ã¯ã¦ãªãã¼ã¯ã¼ãAPIã使ã£ã¦ç¹å¾´èªæ½åº
ããã¤ã¼ããå½¢æ
ç´ è§£æãã¦ã«ãã´ãªåé¡ãããï¼ãã¨ãããã¨ã§ãç°¡æçã«ç¹å¾´èªã®ã«ãã´ãªãå¾ãæ¹æ³ãèãã¾ãã
ãããã¯ã¢ãã«ã¨ããããããã¢ã«ã´ãªãºã ã使ãã®ãæ¬çããããã¾ãããããã£ã¨åç´ã«ãè¸è½ã¸ã£ã³ã«ã®åèªãå¤ãããè¸è½ã¸ã£ã³ã«ã®ãã¤ã¼ããã¿ãããªã®ã§ãããã§ããããéãå¤ããªããï¼1æéæ大100ãã¤ã¼ãï¼ã
ã¨ãããã¨ã§ãã¯ã¦ãªãã¼ã¯ã¼ãèªåãªã³ã¯APIã使ã£ã¦ãæç« ä¸ã®ã¯ã¼ãã®ã«ãã´ãªã調ã¹ã¦ããã¾ãã
ã¯ã¦ãªãã¼ã¯ã¼ãèªåãªã³ã¯APIã¨ã¯
ãã¯ã¦ãªã®è¨äºã£ã¦ãããã£ã½ãèªå¥ã«åæã«ãªã³ã¯ãå¼µããã¦ã¾ããããã¯ã¦ãªãã¼ã¯ã¼ãèªåãªã³ã¯APIã¯ãæç« ãä¸ããã¨ããã®ãããªãªã³ã¯ãèªåã§çæãã¦ãããAPIã§ãã
詳細ï¼はてなキーワードAPI - Hatena Developer Center
ããããããªã³ã¯ãçæããã ãã§ãªãããªã³ã¯ãå¼µãã¹ãåèªãxmlå½¢å¼ã§è¿ãã¦ãããã¨ãã§ãã¾ããä»åã¯ãã¡ãã使ãã¾ãã
ï¼ã¯ã¦ãªãã¼ã¯ã¼ãAPIã¯ã«ãã´ãªãè¿ãã¦ãããªãã®ã§ä»åã¯ä½¿ãã¾ããï¼
ç®æ¨
ããã¤ã¼ãä¸ã«å«ã¾ããåè©ã¨ãã®ã«ãã´ãªãå¾ã
ã³ã¼ãï¼Javaï¼
ãXML-RPC APIã¨ãããããã°ãµã¼ãã¹ã«ããããAPIã«å¯¾å¿ãã¦ããã¨ãããã¨ã§ãXML-RPCã®ã©ã¤ãã©ãªã使ãã¾ããws-xmlrpc - Apache XML-RPCãããã¦ã³ãã¼ããã¦è§£åãlib以ä¸ã®jarãã¡ã¤ã«ãã©ã¤ãã©ãªã«è¿½å ãã¾ããç§ã®å ´åã¯ä»¥ä¸ã追å ã
commons-logging-1.1.jar
ws-commons-util-1.0.2.jar
xmlrpc-client-3.1.3.jar
xmlrpc-common-3.1.3.jar
xmlrpc-server-3.1.3.jar
ã³ã¼ãåèï¼XML-RPC してみる - bluepapa32’s Java Blog
String text = "解æãããæç« "; // URLè¨å® XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); config.setServerURL(new URL("http://d.hatena.ne.jp/xmlrpc")); // XmlRpcClientçæ XmlRpcClient client = new XmlRpcClient(); client.setConfig(config); // ãã©ã¡ã¼ã¿è¨å® Map<Object, Object> params = new HashMap<Object, Object>(); params.put("body", text); // 解æãããæç« params.put("mode", "lite"); // çç¥ããã¨ãªã³ã¯ã¿ã°ä»ãã®æç« ãè¿ã£ã¦ããã¢ã¼ãã« params.put("score", 10); // ãã¼ã¯ã¼ãã®ã¹ã³ã¢ï¼è©³ç´°ä¸æãé¾å¤ãè¨å®ãã¦ããã¨ã©ãã§ãããèªãè¿ã£ã¦ãããã¨ããªããªãæ°ãããï¼ HashMap<Object, Object> result = (HashMap)client.execute("hatena.setKeywordLink", new Object[]{params}); Object[] wordlist = (Object[]) result.get("wordlist"); for(Object word:wordlist){ System.out.println(word); }
textã«
ã¯ã¦ãªãã¼ã¯ã¼ãã§éãã§ãããããªãã¥ã¢ãããã¢ãã¡ãããµã¤ã¨ã³ã¹ãã«åé¡ããã¦ï¼ãªãã§ãµã¤ã¨ã³ã¹ï½ï½ï½ï½ï½ï½ã£ã¦ç¢ºèªãããç§ãééã£ã¦ãâ¦â¦ URL
{refcount=7, score=61, word=ã¯ã¦ãªãã¼ã¯ã¼ã, cname=hatena} {refcount=79, score=69, word=ããªãã¥ã¢, cname=anime} {refcount=78, score=69, word=ããªãã¥ã¢, cname=science} {refcount=36, score=22, word=ãµã¤ã¨ã³ã¹, cname=science} {refcount=1062, score=24, word=ã¢ãã¡, cname=anime} {refcount=2, score=28, word=bit.ly, cname=web}
ãã§ããï¼ã½(ï¾âï¾)ï¾
ããã¨ã¯é©å½ã«è¨ç®å¼ãç«ã¦ã¦ã«ãã´ãªã決ããã°è¶
ç°¡æã«ãã´ãªåé¡ã«ãªãã§ãããã
ãã¡ãªã¿ã«ãã¯ã¦ãªãã¼ã¯ã¼ãã®ã«ãã´ãªã¯はてなキーワード - 話題の言葉がわかる、みんなで編集するキーワードã®ä¸é¨ã«ãã20種é¡ã§ãã
ãwikiã®ãã¼ã¿ã使ã£ãã«ãã´ãªåé¡ã試ããã®ã§ã¾ããã®ãã¡ã