Query the API of using Douban for book Credit Based on ISBN

Source: Internet
Author: User

String apikey = "111111111111111111111111111111"; <br/> string isbnurl = "http://api.douban.com/book/subject/isbn/"; </P> <p> Public static void main (string [] ARGs) throws exception {<br/> // requesturl = isbnurl + isbnno + "? Apikey = "+ apikey; <br/> // eg: http://api.douban.com/book/subject/isbn/9787111298854? Apikey = 111111111111111111114 <br/> ISBN isbntest = New ISBN (); <br/> string isbnno = "9787111298854"; <br/> string xml = isbntest. fetchbookinfobyxml (isbnno); <br/> system. out. println (XML); <br/>}</P> <p>/** <br/> * obtain data from Douban according to ISBN. You have applied for an apikey. A maximum of 40 requests per minute are required. <Br/> * @ Param isbnno <br/> * @ return <br/> * @ throws ioexception <br/> */<br/> Public String fetchbookinfobyxml (string isbnno) throws ioexception {<br/> string requesturl = isbnurl + isbnno + "? Apikey = "+ apikey; <br/> URL url = new URL (requesturl); <br/> urlconnection conn = URL. openconnection (); <br/> inputstream is = Conn. getinputstream (); <br/> inputstreamreader ISR = new inputstreamreader (is, "UTF-8"); <br/> bufferedreader BR = new bufferedreader (ISR ); <br/> stringbuilder sb = new stringbuilder (); </P> <p> string line = NULL; <br/> while (line = BR. readline ())! = NULL) {<br/> Sb. append (line); <br/>}</P> <p> Br. close (); <br/> return sb. tostring (); <br/>} 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.