1. 程式人生 > >必應首頁背景圖片抓包-擷取api

必應首頁背景圖片抓包-擷取api

抓取必應圖片的方法,
作用你可以自己考慮啊。
例如給你的app每天換一個背景,或者給你的桌面換背景
畢竟,必應找的圖的質量還是可以保證的。

1.下面是獲取圖片網址的API

http://cn.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&nc=1501558320736&pid=hp

2.下面是返回的資料

{"images":[{"startdate":"20170731","fullstartdate":"201707311600","enddate":"20170801","url":"/az/hprichbg/rb/Nyala_ZH-CN13349334824_1920x1080.jpg"
,"urlbase":"/az/hprichbg/rb/Nyala_ZH-CN13349334824","copyright":"克魯格國家公園內的雌性安氏林羚,南非 (© Richard Du Toit/Minden Pictures)","copyrightlink":"/search?q=%e5%ae%89%e6%b0%8f%e6%9e%97%e7%be%9a&form=hpcapt&mkt=zh-cn","quiz":"/search?q=Bing+homepage+quiz&filters=WQOskey:%22HPQuiz_20170731_Nyala%22&FORM=HPQUIZ"
,"wp":true,"hsh":"e237228a63e0266666a57d2c9d950109","drk":1,"top":1,"bot":1,"hs":[]}]
,"tooltips":{"loading":"Loading...","previous":"Previous image","next":"Next image","walle":"This image is not available to download as wallpaper.","walls":"Download this image. Use of this image is restricted to wallpaper only."
}
}

3.根據返回的資料就可以拼接出背景影象的網址

http://cn.bing.com/az/hprichbg/rb/Nyala_ZH-CN13349334824_1920x1080.jpg

這就是我們獲取到的影象

4.修改n的值可以獲取多個影象,不過最多隻能得到幾個。

http://cn.bing.com/HPImageArchive.aspx?format=js&idx=0&n=22&nc=1501558320736&pid=hp

返回的結果

{"images":[{"startdate":"20170731","fullstartdate":"201707311600","enddate":"20170801","url":"/az/hprichbg/rb/Nyala_ZH-CN13349334824_1920x1080.jpg","urlbase":"/az/hprichbg/rb/Nyala_ZH-CN13349334824","copyright":"克魯格國家公園內的雌性安氏林羚,南非 (© Richard Du Toit/Minden Pictures)","copyrightlink":"/search?q=%e5%ae%89%e6%b0%8f%e6%9e%97%e7%be%9a&form=hpcapt&mkt=zh-cn","quiz":"/search?q=Bing+homepage+quiz&filters=WQOskey:%22HPQuiz_20170731_Nyala%22&FORM=HPQUIZ","wp":true,"hsh":"e237228a63e0266666a57d2c9d950109","drk":1,"top":1,"bot":1,"hs":[]},{"startdate":"20170730","fullstartdate":"201707301600","enddate":"20170731","url":"/az/hprichbg/rb/Mellieha_ZH-CN10970369201_1920x1080.jpg","urlbase":"/az/hprichbg/rb/Mellieha_ZH-CN10970369201","copyright":"梅利哈俯視檢視,馬耳他 (© Zoltan Gabor/Alamy)","copyrightlink":"/search?q=Mellie%c4%a7a&form=hpcapt&mkt=zh-cn","quiz":"/search?q=Bing+homepage+quiz&filters=WQOskey:%22HPQuiz_20170730_Mellieha%22&FORM=HPQUIZ","wp":true,"hsh":"fa30e98d380192426977789e46db27b6","drk":1,"top":1,"bot":1,"hs":[]},{"startdate":"20170729","fullstartdate":"201707291600","enddate":"20170730","url":"/az/hprichbg/rb/MineralCliffs_ZH-CN11986913181_1920x1080.jpg","urlbase":"/az/hprichbg/rb/MineralCliffs_ZH-CN11986913181","copyright":"畫巖湖濱,美國密歇根州 (© Steve Gettle/Minden Pictures)","copyrightlink":"/search?q=%e7%94%bb%e5%b2%a9%e6%b9%96%e6%bb%a8&form=hpcapt&mkt=zh-cn","quiz":"/search?q=Bing+homepage+quiz&filters=WQOskey:%22HPQuiz_20170729_MineralCliffs%22&FORM=HPQUIZ","wp":true,"hsh":"ef25cb5c669cda5fedfec4ffe4d59e4f","drk":1,"top":1,"bot":1,"hs":[]},{"startdate":"20170728","fullstartdate":"201707281600","enddate":"20170729","url":"/az/hprichbg/rb/WaSqPk_ZH-CN9988391968_1920x1080.jpg","urlbase":"/az/hprichbg/rb/WaSqPk_ZH-CN9988391968","copyright":"華盛頓廣場公園鳥瞰圖,美國紐約 (© New York on Air/Offset)","copyrightlink":"/search?q=%e5%8d%8e%e7%9b%9b%e9%a1%bf%e5%b9%bf%e5%9c%ba%e5%85%ac%e5%9b%ad&form=hpcapt&mkt=zh-cn","quiz":"/search?q=Bing+homepage+quiz&filters=WQOskey:%22HPQuiz_20170728_WaSqPk%22&FORM=HPQUIZ","wp":false,"hsh":"56c3a6fcef27ca12ba7c559d54fb986f","drk":1,"top":1,"bot":1,"hs":[]},{"startdate":"20170727","fullstartdate":"201707271600","enddate":"20170728","url":"/az/hprichbg/rb/TempleStreet_ZH-CN7471755280_1920x1080.jpg","urlbase":"/az/hprichbg/rb/TempleStreet_ZH-CN7471755280","copyright":"香港油麻地廟街夜市 (© Peter Stewart/500px)","copyrightlink":"/search?q=%e5%ba%99%e8%a1%97%e5%a4%9c%e5%b8%82&form=hpcapt&mkt=zh-cn","quiz":"/search?q=Bing+homepage+quiz&filters=WQOskey:%22HPQuiz_20170727_TempleStreet%22&FORM=HPQUIZ","wp":true,"hsh":"c938ba8a09fc7c9d9232891eef4d5794","drk":1,"top":1,"bot":1,"hs":[]},{"startdate":"20170726","fullstartdate":"201707261600","enddate":"20170727","url":"/az/hprichbg/rb/HuangshanClouds_ZH-CN11669699321_1920x1080.jpg","urlbase":"/az/hprichbg/rb/HuangshanClouds_ZH-CN11669699321","copyright":"黃山,中國安徽省 (© Oktay Ortakcioglu/Getty Images)","copyrightlink":"/search?q=%e9%bb%84%e5%b1%b1&form=hpcapt&mkt=zh-cn","quiz":"/search?q=Bing+homepage+quiz&filters=WQOskey:%22HPQuiz_20170726_HuangshanClouds%22&FORM=HPQUIZ","wp":true,"hsh":"ac54af19ad5a3614419b7b6e613b07b5","drk":1,"top":1,"bot":1,"hs":[]},{"startdate":"20170725","fullstartdate":"201707251600","enddate":"20170726","url":"/az/hprichbg/rb/WilsonPeakWindow_ZH-CN10363033426_1920x1080.jpg","urlbase":"/az/hprichbg/rb/WilsonPeakWindow_ZH-CN10363033426","copyright":"從鬼城Alta看到的威爾遜峰,美國科羅拉多州 (© Grant Ordelheide/Tandem Stills + Motion)","copyrightlink":"/search?q=Wilson+Peak&form=hpcapt&mkt=zh-cn","quiz":"/search?q=Bing+homepage+quiz&filters=WQOskey:%22HPQuiz_20170725_WilsonPeakWindow%22&FORM=HPQUIZ","wp":false,"hsh":"5287e909cbbb7cf8b7b71318c8f47ab6","drk":1,"top":1,"bot":1,"hs":[]},{"startdate":"20170724","fullstartdate":"201707241600","enddate":"20170725","url":"/az/hprichbg/rb/ReinebringenRidge_ZH-CN9518224182_1920x1080.jpg","urlbase":"/az/hprichbg/rb/ReinebringenRidge_ZH-CN9518224182","copyright":"莫斯克內斯島雷訥村雷納布林根山嶺的景觀,挪威 (© David Varga/Shutterstock)","copyrightlink":"/search?q=Reinebringen+ridge&form=hpcapt&mkt=zh-cn","quiz":"/search?q=Bing+homepage+quiz&filters=WQOskey:%22HPQuiz_20170724_ReinebringenRidge%22&FORM=HPQUIZ","wp":false,"hsh":"b3dee25bbc74dd72e45952aef811479b","drk":1,"top":1,"bot":1,"hs":[]}],"tooltips":{"loading":"Loading...","previous":"Previous image","next":"Next image","walle":"This image is not available to download as wallpaper.","walls":"Download this image. Use of this image is restricted to wallpaper only."}}