Mat*_*zen 108
我认为最好的方法是通过他们的AJAX调用来模仿他们自己做的方式.
他们调用此URL并通过XML反序列化提取信息.
XML: http ://www.bing.com/HPImageArchive.aspx?format = xml&idx = 0&n = 1&mkt = en-US
JSON: http ://www.bing.com/HPImageArchive.aspx?format = js&idx = 0&n = 1&mkt = en-US
RSS: http ://www.bing.com/HPImageArchive.aspx?format = rss&idx = 0&n = 1&mkt = en-US
该mkt属性显然可以更改为与'en-US'不同的区域,但如果您不关心特定区域,也可以完全选择该属性.
请注意,_1366x768.jpg添加到图像名称的后缀似乎可以修改为不同的分辨率(例如_1920x1080.jpg全高清和可能的其他分辨率).
以下是截至2013年9月28日的数据转储,采用XML格式.
<?xml version="1.0" encoding="utf-8"?>
<images>
<image>
<startdate>20130928</startdate>
<fullstartdate>201309280000</fullstartdate>
<enddate>20130929</enddate>
<url>/az/hprichbg/rb/LakeTurkana_EN-US15976511099_1366x768.jpg</url>
<urlBase>/az/hprichbg/rb/LakeTurkana_EN-US15976511099</urlBase>
<copyright>Lava rock pools at the southern end of Lake Turkana, in Kenya (© Nigel Pavitt/Corbis)</copyright>
<copyrightlink>http://www.bing.com/search?q=Lake+Turkana%2C+Kenya&form=hpcapt</copyrightlink>
<drk>1</drk>
<top>1</top>
<bot>1</bot>
<hotspots>
<hotspot>
<desc>These are the southern reaches of a lake...</desc>
<link>http://www.bing.com/maps/?v=2&cp=2.794725~37.335197&lvl=7&dir=0&sty=b&q=Lake%20Turkana%2C%20Kenya&form=hphot1</link>
<query>That stretches for 180 miles, up into another country</query>
<LocX>15</LocX>
<LocY>33</LocY>
</hotspot>
<hotspot>
<desc>This body of water was once called the Jade Sea.</desc>
<link>http://www.bing.com/search?q=green+algae&form=hphot2</link>
<query>What gives the water here its sometimes vibrant hue?</query>
<LocX>37</LocX>
<LocY>42</LocY>
</hotspot>
<hotspot>
<desc>One of the world's most powerful predators lives here.</desc>
<link>http://www.bing.com/videos/search?q=Underwater+Croc+Cams+National+Geographic&FORM=hphot3#view=detail&mid=D25E1909D3514A8732C5D25E1909D3514A8732C5</link>
<query>See some rare underwater footage of the beast</query>
<LocX>66</LocX>
<LocY>33</LocY>
</hotspot>
<hotspot>
<desc>Many fossils of ancient human ancestors have been uncovered in the surrounding area.</desc>
<link>http://www.bing.com/search?q=Turkana+Boy&form=hphot4</link>
<query>One skeleton was so complete, paleoanthropologists gave him a name</query>
<LocX>82</LocX>
<LocY>41</LocY>
</hotspot>
</hotspots>
<messages></messages>
</image>
<tooltips>
<loadMessage>
<message>Indlæser...</message>
</loadMessage>
<previousImage>
<text>Forrige</text>
</previousImage>
<nextImage>
<text>Næste</text>
</nextImage>
<play>
<text>Afspil</text>
</play>
<pause>
<text>Pause</text>
</pause>
</tooltips>
</images>
Run Code Online (Sandbox Code Playgroud)
Siv*_*Siv 29
我找到了一种获取当天Bing Image的JSON格式的方法
n=您想要的图像数量(您可以使用整数),
mkt=您的位置(例如:en-US)
{
"images": [
{
"startdate": "20141214",
"fullstartdate": "201412141830",
"enddate": "20141215",
"url": "\/az\/hprichbg\/rb\/BlackButte_EN-IN7038391888_1920x1080.jpg",
"urlbase": "\/az\/hprichbg\/rb\/BlackButte_EN-IN7038391888",
"copyright": "Black Butte, seen from the Mount Jefferson Wilderness, Oregon, USA (\u00a9 Marc Adamus\/Aurora Photos)",
"copyrightlink": "http:\/\/www.bing.com\/search?q=Black+Butte&qs=n&form=hpcapt&mkt=en-in&pq=black+butte&sc=8-11&sp=-1&sk=&cvid=228ac7f125f94bbaafd4a4abd4f9a32d",
"wp": true,
"hsh": "94156ae1e2e1be49f9b739d2b7bff65c",
"drk": 1,
"top": 1,
"bot": 1,
"hs": [
],
"msg": [
{
"title": "How does it feel\u2026",
"link": "http:\/\/www.bing.com\/videos\/search?q=Climbing+Black+Butte&FORM=pgbar1&mkt=en-in#view=detail&mid=58BDB2F2B9FCB85D597558BDB2F2B9FCB85D5975",
"text": "To climb 1961.7 m?"
},
{
"title": "On top of the world",
"link": "http:\/\/www.bing.com\/images\/search?q=Pictures+From+the+Top+of+Mount+Everest&FORM=pgbar2&mkt=en-in",
"text": "It's mountaineer's dream view"
}
]
}
],
"tooltips": {
"loading": "Loading...",
"previous": "Previous",
"next": "Next",
"walle": "This image is not available to download as wallpaper.",
"walls": "Download this image. Use of this image is restricted to wallpaper only."
}
}
Run Code Online (Sandbox Code Playgroud)
使用url来自images[]
并将其添加到 'http://bing.com'
这里的网址是 "url": "\/az\/hprichbg\/rb\/DayGecko_EN-US8730336235_1366x768.jpg"
kar*_*ior 10
Microsoft最近发布了针对Windows 7 的Bing动态主题,其中包含一个RSS Feed,其中包含Bing壁纸的链接.
还有一个Python脚本试图加载Bing网站并猜测正确的图像URL,但根据我的经验,它通常会导致图像分辨率低于RSS源提供的图像.
Bash 一个衬垫(需要 bash、curl 和 jq),对于放入 cronjob 很有用:
BACKGROUND_META=$(curl 'https://www.bing.com/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=en-US'); curl -o $(echo $BACKGROUND_META | jq -r '.images[0].urlbase' | sed s/.*=//).jpg "https://bing.com$(echo $BACKGROUND_META| jq -r '.images[0].url')"
Run Code Online (Sandbox Code Playgroud)
一台Liner PowerShell(3.0或更高版本)
irm 是的别名 Invoke-RestMethod
irm "bing.com$((irm "bing.com/HPImageArchive.aspx?format=js&mkt=en-IN&n=1").images[0].url)" -OutFile bing.jpg
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
66041 次 |
| 最近记录: |