简体   繁体   English

使用Facebook API从页面的所有相册中获取所有照片。 缓存还是查询?

[英]Getting all photos from all albums of a page using the Facebook API. Cache or query?

I'm wanting to get all the photos (and their respective comments, likes, and tags) from all the albums of a Facebook page (which is public). 我想要从Facebook页面的所有专辑(公开的)获取所有照片(以及他们各自的评论,喜欢和标签)。 And while I know how to get this information using the Facebook API (or using FQL), my question is more about if I should store this information or not. 虽然我知道如何使用Facebook API(或使用FQL)获取此信息,但我的问题更多的是关于我是否应该存储此信息。

I have two options as I see it: create a query for the Facebook API and display the results accordingly OR have a CRON job run a PHP script which updates my database every few minutes and pull information from that database. 我有两个选项:为Facebook API创建一个查询并相应地显示结果让CRON作业运行一个PHP脚本,每隔几分钟更新一次我的数据库并从该数据库中提取信息。

Facebook does have the ability to do real-time updates of information; Facebook确实有能力进行信息的实时更新 ; however, as of right now, they don't support photos or albums so this is clearly not an option. 但是,截至目前,他们不支持照片或专辑,所以这显然不是一种选择。

To let you know the amount of information I'd be dealing with, the page I'd be working with contains roughly 40 albums (and counting) and most albums contain roughly the maximum of 200 images. 为了让您知道我要处理的信息量,我正在使用的页面包含大约40张专辑(并且正在计数),大多数专辑最多包含200张图片。 That's a lot of information! 这是很多信息! If anybody has experience with caching results of API calls, then I'd greatly appreciate your input. 如果有人有缓存API调用结果的经验,那么我非常感谢您的输入。 Thanks! 谢谢!

cereallarceny cereallarceny

I am working on something very similar to feed albums and photos for pages and apps. 我的工作很相似, 饲料相册和照片的网页和应用程序的东西。 I only need to ever store the id of the album and photo, everything else i can pull live from graph api from the 2 id's. 我只需要存储专辑和照片的ID,我可以从2 id的图表api中获取所有其他内容。

a big page "lets say walmart" https://shawnsspace.com/plugins/TimeLinegallery.php?pageid=walmart has about 350 albums and roughly 20 photos in most of the albums. 一个大页面“让我们说沃尔玛” https://shawnsspace.com/plugins/TimeLinegallery.php?pageid=walmart在大多数专辑中有大约350张专辑和大约20张照片。

I estimate their entire gallery to be over 3 gig, not including comments and like data, and resized images. 我估计他们的整个画廊超过3演出,不包括评论和类似的数据,以及调整大小的图像。

In my opinion it is alot less taxing to feed the information per user than it is to cache all the info, with can / will change daily even hourly. 在我看来,每个用户提供的信息比缓存所有信息的费用要少,每天甚至每小时都会改变。


About cron jobs - you have a mau limit on your app for api requests per day. 关于cron jobs - 你的应用程序每天都有api请求的限制。 to poll all the albums and photos for your est: sized gallery could put above that limit, and Facebook would remove your access until that mau limit resets or until you get written permission to go over the limit. 轮询您的所有专辑和照片:大小的画廊可以超过该限制,Facebook将删除您的访问权限,直到该mau限制重置或直到您获得超过限制的书面许可。

If you exceed, or plan to exceed, any of the following thresholds please contact us as you may be subject to additional terms: (>5M MAU) or (>100M API calls per day) or (>50M impressions per day). 如果您超过或计划超过以下任何阈值,请与我们联系,因为您可能需要遵守附加条款:(> 5M MAU)或(>每天100M API调用)或(>每天50M印象)。


On a second NOTE: all the objects you need have an last updated_date: you could make the calls and just cache what has a date that is != to the last updated_date. 在第二个注意:您需要的所有对象都有一个last_date:您可以进行调用,只是将具有日期的内容缓存到最后一个updated_date。 This will reduce your transfer time and size considerably but will not reduce the number of calls needed to check. 这将大大减少您的传输时间和大小,但不会减少检查所需的呼叫数量。

Since most of this content could change on a regular basis, such as likes, tags, and additions, storing it wouldn't be a great idea. 由于大多数内容可能会定期更改,例如喜欢,标记和添加,因此存储它不是一个好主意。 Are there any specific reasons you need to store it? 您需要存储它的具体原因吗? Fetching it from Facebooks CDN would also be faster. 从Facebook获取它CDN也会更快。 What you could do is store the links and such, but I would download the actual pictures and connections real time. 你可以做的是存储链接等,但我会实时下载实际的图片和连接。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM