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

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

1、百度

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

[html][/html] view plaincopyprint?

  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

 

 

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

 

[html][/html] view plaincopyprint?

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

 

 

几个关键参数:

width&height:长宽

word:查询关键词

rn:每页显示图片数量

pn:图片显示的页码

 

参考返回结果如下

 

[html][/html] view plaincopyprint?

  1. {
  2.     “queryEnc”: “girl”,
  3.     “queryExt”: “girl”,
  4.     “listNum”: 1999,
  5.     “displayNum”: 21929725,
  6.     “bdFmtDispNum”: “约21,900,000”,
  7.     “bdSearchTime”: “6.000”,
  8.     “bdIsClustered”: “1”,
  9.     “data”: [
  10.         {
  11.             “thumbURL”: “http://t10.baidu.com/it/u=1025587248,1458534674&fm=59”,
  12.             “middleURL”: “”,
  13.             “largeTnImageUrl”: “http://t12.baidu.com/it/u=924334832,1400490131&fm=59”,
  14.             “hasLarge”: 0,
  15.             “hoverURL”: “http://t11.baidu.com/it/u=1001163760,1466976252&fm=59”,
  16.             “pageNum”: 1,
  17.             “objURL”: “http://www.widewallpapers.ru/mod/girls/3/1920×1200/hot-girl-wallpaper-1920×1200-008.jpg”,
  18.             “fromURL”: “http://hdw.eweb4.com/out/687817.html”,
  19.             “fromURLHost”: “http://hdw.eweb4.com”,
  20.             “currentIndex”: “0”,
  21.             “width”: 1920,
  22.             “height”: 1200,
  23.             “type”: “jpg”,
  24.             “filesize”: “715”,
  25.             “bdSrcType”: “5”,
  26.             “di”: “0”,
  27.             “is”: “0”,
  28.             “bdSetImgNum”: 0,
  29.             “bdImgnewsDate”: “2013-02-01 13:22:13”,
  30.             “fromPageTitle”: “<strong>girl</strong>”,
  31.             “fromPageTitleEnc”: “<strong>girl</strong>”,
  32.             “bdSourceName”: “”,
  33.             “bdFromPageTitlePrefix”: “”,
  34.             “token”: “0”
  35.         },
  36.         {
  37.             “thumbURL”: “http://t10.baidu.com/it/u=642396156,1965090283&fm=59”,
  38.             “middleURL”: “”,
  39.             “largeTnImageUrl”: “http://t10.baidu.com/it/u=636229272,1901199173&fm=59”,
  40.             “hasLarge”: 0,
  41.             “hoverURL”: “http://t10.baidu.com/it/u=657566964,1952941079&fm=59”,
  42.             “pageNum”: 2,
  43.             “objURL”: “http://www.mrwallpaper.com/wallpapers/blonde-girl-green-eyes-1920×1200.jpg”,
  44.             “fromURL”: “http://hdw.eweb4.com/out/650129.html”,
  45.             “fromURLHost”: “http://hdw.eweb4.com”,
  46.             “currentIndex”: “0”,
  47.             “width”: 1920,
  48.             “height”: 1200,
  49.             “type”: “jpg”,
  50.             “filesize”: “436”,
  51.             “bdSrcType”: “5”,
  52.             “di”: “0”,
  53.             “is”: “0”,
  54.             “bdSetImgNum”: 0,
  55.             “bdImgnewsDate”: “2013-02-01 13:22:13”,
  56.             “fromPageTitle”: “<strong>girl</strong>”,
  57.             “fromPageTitleEnc”: “<strong>girl</strong>”,
  58.             “bdSourceName”: “”,
  59.             “bdFromPageTitlePrefix”: “”,
  60.             “token”: “0”
  61.         },
  62.         {}
  63.     ]
  64. }

 

 

2、谷歌

谷歌就比较好了,地址如下:https://developers.google.com/image-search/v1/jsondevguide

参考查询地址:https://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=girl

请求参数:https://developers.google.com/image-search/v1/jsondevguide#request_format

返回实例:

 

[html][/html] view plaincopyprint?

  1. {
  2.     “responseData”: {
  3.         “results”: [
  4.             {
  5.                 “GsearchResultClass”: “GimageSearch”,
  6.                 “width”: “1024”,
  7.                 “height”: “768”,
  8.                 “imageId”: “ANd9GcRSKgavyK2uIEyZOKOmBM27QFmMoEZn6prf2eSLspHIJ43TUx2GWLEd6N_l”,
  9.                 “tbWidth”: “150”,
  10.                 “tbHeight”: “113”,
  11.                 “unescapedUrl”: “http://www.hdwpapers.com/walls/absolutely_innocent_princess_baby_girl_wallpaper-normal.jpg”,
  12.                 “url”: “http://www.hdwpapers.com/walls/absolutely_innocent_princess_baby_girl_wallpaper-normal.jpg”,
  13.                 “visibleUrl”: “www.hdwpapers.com”,
  14.                 “title”: “absolutely innocent princess baby 003cb003egirl003c/b003e wallpaper”,
  15.                 “titleNoFormatting”: “absolutely innocent princess baby girl wallpaper”,
  16.                 “originalContextUrl”: “http://www.hdwpapers.com/absolutely_innocent_princess_baby_girl_wallpaper-wallpapers.html”,
  17.                 “content”: “absolutely innocent princess baby 003cb003egirl003c/b003e wallpaper”,
  18.                 “contentNoFormatting”: “absolutely innocent princess baby girl wallpaper”,
  19.                 “tbUrl”: “http://t2.gstatic.com/images?q003dtbn:ANd9GcRSKgavyK2uIEyZOKOmBM27QFmMoEZn6prf2eSLspHIJ43TUx2GWLEd6N_l”
  20.             },
  21.             {
  22.                 “GsearchResultClass”: “GimageSearch”,
  23.                 “width”: “1920”,
  24.                 “height”: “1080”,
  25.                 “imageId”: “ANd9GcQUnyHrVEbppqhZnWnQrijhBFP0X34gRf7pKw6PdT4ggepB2k9g-p71sgGh”,
  26.                 “tbWidth”: “150”,
  27.                 “tbHeight”: “84”,
  28.                 “unescapedUrl”: “http://static.hothdwallpaper.net/51baa511ad24454887.jpg”,
  29.                 “url”: “http://static.hothdwallpaper.net/51baa511ad24454887.jpg”,
  30.                 “visibleUrl”: “ch.hothdwallpaper.net”,
  31.                 “title”: “Beautiful 003cb003eGirls003c/b003e HD Arena桌布壁纸1920×1080 – 热门壁纸网”,
  32.                 “titleNoFormatting”: “Beautiful Girls HD Arena桌布壁纸1920×1080 – 热门壁纸网”,
  33.                 “originalContextUrl”: “http://ch.hothdwallpaper.net/wallpapers/hd/607550/beautiful-girls-wallpapers-hd-wallpapers-arena”,
  34.                 “content”: “Beautiful 003cb003eGirls003c/b003e HD Arena桌布壁纸1920×1080 – 热门壁纸网”,
  35.                 “contentNoFormatting”: “Beautiful Girls HD Arena桌布壁纸1920×1080 – 热门壁纸网”,
  36.                 “tbUrl”: “http://t2.gstatic.com/images?q003dtbn:ANd9GcQUnyHrVEbppqhZnWnQrijhBFP0X34gRf7pKw6PdT4ggepB2k9g-p71sgGh”
  37.             },
  38.             {
  39.                 “GsearchResultClass”: “GimageSearch”,
  40.                 “width”: “614”,
  41.                 “height”: “500”,
  42.                 “imageId”: “ANd9GcQu8KfNqGL9v9ftBZze2GwKYknGKqGfdSfwEiszbfk7gQKOlP58-UqjgZH0”,
  43.                 “tbWidth”: “136”,
  44.                 “tbHeight”: “111”,
  45.                 “unescapedUrl”: “http://www.esquire.com/cm/esquire/images/SZ/esq-something-cool-we-saw-online-girl-habit-de.jpg”,
  46.                 “url”: “http://www.esquire.com/cm/esquire/images/SZ/esq-something-cool-we-saw-online-girl-habit-de.jpg”,
  47.                 “visibleUrl”: “www.esquire.com”,
  48.                 “title”: “Something Cool We Saw Online: 003cb003eGirl003c/b003e Habit – Esquire”,
  49.                 “titleNoFormatting”: “Something Cool We Saw Online: Girl Habit – Esquire”,
  50.                 “originalContextUrl”: “http://www.esquire.com/blogs/mens-fashion/girl-habit-tumblr-111612”,
  51.                 “content”: “Something Cool We Saw Online: 003cb003eGirl003c/b003e Habit – Esquire”,
  52.                 “contentNoFormatting”: “Something Cool We Saw Online: Girl Habit – Esquire”,
  53.                 “tbUrl”: “http://t1.gstatic.com/images?q003dtbn:ANd9GcQu8KfNqGL9v9ftBZze2GwKYknGKqGfdSfwEiszbfk7gQKOlP58-UqjgZH0”
  54.             },
  55.             {
  56.                 “GsearchResultClass”: “GimageSearch”,
  57.                 “width”: “1920”,
  58.                 “height”: “1200”,
  59.                 “imageId”: “ANd9GcQzZsnXYPvBJuUpq_5QCEl3inUAYNBXx5SvZx2Vx63xTMnKvXXE5ub9pnTn”,
  60.                 “tbWidth”: “150”,
  61.                 “tbHeight”: “94”,
  62.                 “unescapedUrl”: “http://freefever.com/stock/girl-beautiful-wallpapers.jpg”,
  63.                 “url”: “http://freefever.com/stock/girl-beautiful-wallpapers.jpg”,
  64.                 “visibleUrl”: “www.freefever.com”,
  65.                 “title”: “003cb003eGirl003c/b003e Beautiful Wallpapers – 1920×1200 pixel Wallpaper #49068 003cb003e…003c/b003e”,
  66.                 “titleNoFormatting”: “Girl Beautiful Wallpapers – 1920×1200 pixel Wallpaper #49068 …”,
  67.                 “originalContextUrl”: “http://www.freefever.com/wallpaper/1920×1200/girl-beautiful-wallpapers-49068.html”,
  68.                 “content”: “003cb003eGirl003c/b003e Beautiful Wallpapers – 1920×1200 pixel Wallpaper #49068”,
  69.                 “contentNoFormatting”: “Girl Beautiful Wallpapers – 1920×1200 pixel Wallpaper #49068”,
  70.                 “tbUrl”: “http://t2.gstatic.com/images?q003dtbn:ANd9GcQzZsnXYPvBJuUpq_5QCEl3inUAYNBXx5SvZx2Vx63xTMnKvXXE5ub9pnTn”
  71.             }
  72.         ],
  73.         “cursor”: {
  74.             “resultCount”: “7,330,000,000”,
  75.             “pages”: [
  76.                 {
  77.                     “start”: “0”,
  78.                     “label”: 1
  79.                 },
  80.                 {
  81.                     “start”: “4”,
  82.                     “label”: 2
  83.                 },
  84.                 {
  85.                     “start”: “8”,
  86.                     “label”: 3
  87.                 },
  88.                 {
  89.                     “start”: “12”,
  90.                     “label”: 4
  91.                 },
  92.                 {
  93.                     “start”: “16”,
  94.                     “label”: 5
  95.                 },
  96.                 {
  97.                     “start”: “20”,
  98.                     “label”: 6
  99.                 },
  100.                 {
  101.                     “start”: “24”,
  102.                     “label”: 7
  103.                 },
  104.                 {
  105.                     “start”: “28”,
  106.                     “label”: 8
  107.                 }
  108.             ],
  109.             “estimatedResultCount”: “7330000000”,
  110.             “currentPageIndex”: 0,
  111.             “moreResultsUrl”: “http://www.google.com/images?oe003dutf80026ie003dutf80026source003duds0026start003d00026hl003dzh-CN0026q003dgirl”,
  112.             “searchResultTime”: “0.20”
  113.         }
  114.     },
  115.     “responseDetails”: null,
  116.     “responseStatus”: 200
  117. }

标签