使用Picasa API显示Picasa照片时,如何避免延迟? [英] How to avoid delay when displaying Picasa photos using Picasa API?

查看:127
本文介绍了使用Picasa API显示Picasa照片时,如何避免延迟?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用Google Picasa API(C#)在我的网站上显示公共Picasa网络相册中的照片。

I’m currently working with the Google Picasa API (C#) to display photos from public Picasa web album on my website.

问题是从网络相册更改完成到通过API反映更改之间的延迟(秒到分钟)。
我需要立即反映出来:当新照片上传到相册时,我需要在网站上的同一时间正确显示它。

The issue is that there is a delay (seconds to minutes) from the moment changes are done in web album to the moment it is reflected via API. I need it to be reflected immediately: When new photo is uploaded to the album I need it to be displayed on the same time exactly in the web site.

当我发现输入IE9或Chrome的URL(http://picasaweb.google.com/data/feed/api/user//albumid/)时显示更改而没有延迟时,它变得更加有趣。

It got even more interesting when I found out changes are displayed without delay when entering the URL (http://picasaweb.google.com/data/feed/api/user//albumid/) to IE9 or Chrome.

我也尝试过通过HttpWebRequest调用上述URL并设置所有无缓存标头,但这并不能解决问题。

I have also tried to call the above URL via HttpWebRequest and set all no-cache headers, but it didnt solve the issue.

在这种情况下,浏览器的请求与HttpWebRequest / API完成的请求之间有什么区别?
任何人都可以把我带向正确的方向吗?

So, what is the difference between browsers request to the request done by the HttpWebRequest/API on this case? Can anyone put me in the right direction?

谢谢

推荐答案

以防万一您还没有发现并可能仍然感兴趣,我遇到了完全相同的问题(尽管在PHP中),事实证明匿名请求被延迟了,而授权请求却是即时的。由于您的浏览器包含一个包含您的Google帐户的cookie,因此它被视为授权请求,因此会立即进行更新。但是,代码中的请求仍然是匿名的。

Just in case you haven't found out and might still be interested, I had the exact same problem (though in PHP) and it turns out that anonymous requests are delayed, while authorized requests are instant. Because your browser contained a cookie with your Google account, it counted as an authorized request and therefore was instantly updated. However, the request by the code was still anonymous.

解决方案是进行HTTP POST来检索供稿,并按照此处

The solution would be to make an HTTP POST to retrieve the feed, and authorize the request as described here.

这篇关于使用Picasa API显示Picasa照片时,如何避免延迟?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆