Greetings Well i am ready to give up - it taking me a lot of time learning how to use Yahoo API. after with forums help i realized that i need to download all kind of JAXB and JAXME jars. I finally was able to go without errors - until i got the : java.net.UnknownHostException: api.search.yahoo.com My program is simple (java one): try { SearchClient x = new SearchClient("myCode"); WebSearchRequest u = new WebSearchRequest("test word"); WebSearchResults z; WebSearchResult d; x.webSearch(u); d = z.listResults()[0]; System.out.println(d.getTitle()); } catch (SearchException v) { System.out.println(v.toString() ); } catch (IOException v) { System.out.println(v.toString() ); } So why does it throw this exception ? and how come others use it so quickly ? I don't remember having such a hard time with Google API. anyone know ? Thanx in advance
Do you really need to use Java as your mechanism to query the API? It's much easier to just make an HTTP request to it and you get nicely formatted XML as a result.
However the java thing cover the XML for me so i do not use to do any analysis (like google api) I am not yet familiar with the XML mechanizm in java. However i'll be happy to see a sample how to work with the Yahoo API XML *there is an example in their site - but they do not show how to analyze the XML. Maybe this will be easier
I had a problem i was using Yahoo API . SearchClient client = new SearchClient("javasdktest"); try{ if("image".equals(type)){ ImageSearchRequest searchRequest = new ImageSearchRequest(URLEncoder.encode(word, "UTF-8")); // 是否显示成人内容 searchRequest.setAdultOk(adultOk); // 查询记录数 searchRequest.setResults(20); // 从第 0 条记录开始显示 searchRequest.setStart(BigInteger.valueOf(0)); double startTime = System.currentTimeMillis(); System.out.println("haha"); ImageSearchResults results = client.imageSearch(searchRequest); the context colored could not go ,can anyone help me? Thanx in advance