日期:2014-05-16  浏览次数:20349 次

整理下返回JSON的图片搜索的API

最近想测试volley的异步图片加载,每次都去找图片效果很不理想,下载了几个国外的demo,不是调的facebook的就是twitter,虽然可以VPN,但是感觉很不方便,国内的花了好久找了几个,都是不好使,最后找到这两个东西,谷歌和百度。

1、百度

参考地址(来自互联网):

http://image.baidu.com/i?tn=baiduimagejson&ct=201326592&cl=2&lm=-1&st=-1&fm=result&fr=&sf=1&fmq=1349413075627_R&pv=&ic=0&nc=1&z=&se=1&showtab=0&fb=0&width=&height=&face=0&istype=2&word=girl&rn=2&pn=1


这个地址比较长,删除一下参数:

http://image.baidu.com/i?tn=baiduimagejson&width=&height=&word=girl&rn=10&pn=2


几个关键参数:

width&height:长宽

word:查询关键词

rn:每页显示图片数量

pn:图片显示的页码


参考返回结果如下

{
    "queryEnc": "girl",
    "queryExt": "girl",
    "listNum": 1999,
    "displayNum": 21929725,
    "bdFmtDispNum": "约21,900,000",
    "bdSearchTime": "6.000",
    "bdIsClustered": "1",
    "data": [
        {
            "thumbURL": "http://t10.baidu.com/it/u=1025587248,1458534674&fm=59",
            "middleURL": "",
            "largeTnImageUrl": "http://t12.baidu.com/it/u=924334832,1400490131&fm=59",
            "hasLarge": 0,
            "hoverURL": "http://t11.baidu.com/it/u=1001163760,1466976252&fm=59",
            "pageNum": 1,
            "objURL": "http://www.widewallpapers.ru/mod/girls/3/1920x1200/hot-girl-wallpaper-1920x1200-008.jpg",
            "fromURL": "http://hdw.eweb4.com/out/687817.html",
            "fromURLHost": "http://hdw.eweb4.com",
            "currentIndex": "0",
            "width": 1920,
            "height": 1200,
            "type": "jpg",
            "filesize": "715",
            "bdSrcType": "5",
            "di": "0",
            "is": "0",
            "bdSetImgNum": 0,
            "bdImgnewsDate": "2013-02-01 13:22:13",
            "fromPageTitle": "<strong>girl</strong>",
            "fromPageTitleEnc": "<strong>girl</strong>",
            "bdSourceName": "",
            "bdFromPageTitlePrefix": "",
            "token": "0"
        },
        {
            "thumbURL": "http://t10.baidu.com/it/u=642396156,1965090283&fm=59",
            "middleURL": "",
            "largeTnImageUrl": "http://t10.baidu.com/it/u=636229272,1901199173&fm=59",
            "hasLarge": 0,
            "hoverURL": "http://t10.baidu.com/it/u=657566964,1952941079&fm=59",
            "pageNum": 2,
            "objURL": "http://www.mrwallpaper.com/wallpapers/blonde-girl-green-eyes-1920x1200.jpg",
            "fromURL": "http://hdw.eweb4.com/out/650129.html",
            "fromURLHost": "http://hdw.eweb4.com",
            "currentIndex": "0",
            "width": 1920,
            "height": 1200,
            "type": "jpg",
            "filesize": "436",
            "bdSrcType": "5",
            "di": "0",
            "is": "0",
            "bdSetImgNum": 0,
            "bdImgnewsDate": "2013-02-01 13:22:13",
            "fromPageTitle": &quo