简体   繁体   中英

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). 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.

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 does have the ability to do real-time updates of information; 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. That's a lot of information! If anybody has experience with caching results of API calls, then I'd greatly appreciate your input. Thanks!

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.

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.

I estimate their entire gallery to be over 3 gig, not including comments and like data, and resized images.

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. 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.

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).


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. 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. What you could do is store the links and such, but I would download the actual pictures and connections real time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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