Caching Feeds from Facebook, Twitter & Instagram - facebook

I'm building a site for a non-profit festival where we'd like to have a 'media' page which brings in photos from instagram (hashtag search), updates and photos from Facebook (via festival's albums) twitter posts (by user and hashtag).
I've tried the JS widgets for Facebook and Twitter but wondered about using PHP/Codeigniter to pull the feeds and caching them somehow for better performance and more control over the look.
Would it be best to then store the feed data in a json file on the server or in a MySQL record?
I'm leaning toward a table with a record for each feed that would basically just store the feed URL, JSON, last updated time and an identifier of some sort.
Then I could write a class with the following type of methods:
get_feed($id='facebook_updates', $expiry_time=3600);
Does this seem like a reasonable way to go? or is there a better solution already existing?
I'm not quite sure how I'd work that in with the feeds that need Auth (twitter & Instagram)

bro!
First, it does seem a reasonable way to do it and I don't know any better.
But, if I had to accomplish that, I would break my problem in two:
A server side code to grab the info from the services (that I would
probably store as json so that I could use the info returned
directly) running with cronjobs from time to time.
A client side (server would work too) one to show that info with
customized style.
To work with the feeds that need auth, you'll have to create an app in each of them, authorize it to access your personal account and use it in the code. Never worked with Instagram but the others have good documentation on how to do that.
Finally, with some modification, you may be able to use this wonderful too to help you accomplish your task: http://plugins.in1.com/socialist

Related

Facebook app id for website social plugins

I have like/share buttons on my website and am not currently using an appid. Finding information on whether this is a necessity for the above configuration is difficult to confirm. When going through the Facebook app "create" forms, I'm really confused by a lot of the requirements as it seems to be more focused around actual apps rather than websites, which login via fb etc.
In the past I have created an app for one of my other websites and I don't believe there was any verification/submission process at this point (about 2-3 years ago). Reviewing my old app configuration now I can see that it is not "live" - does anyone know whether Facebook implemented this submission process in the last couple of years, and then de-activated any live apps that were created prior to this?
I now want to setup a new app for my new website and I'm unsure what the different 'action types' mean and what I would need to simply use like/share buttons on the website. Could someone give me a quick run down of what I'd need and what they are?
Any other info/tips people can provide would be greatly appreciated. I'm finding that the like/share DO still work without the app, but sometimes the share button doesn't work properly (I have a feeling this is something to do with the app).
Thanks
If you are just using the Social Plugins, you don't need to have a Facebook App ID.
If you want more integration, it will be required. Creating an App ID is like registering your App, wether an iOS or Android App or just a website, so that you can make Graph API calls for it.
The easiest way to register your website is to go the quickstart: https://developers.facebook.com/quickstarts/?platform=web (or https://developers.facebook.com/apps). There you can type a name and follow the steps.
You can then follow the "Sharing best practices" (https://developers.facebook.com/docs/sharing/best-practices#tags) on how to use the App ID. For example, by including an fb:app_id meta tag on your pages.
There is a review process, since last April, but that is only needed if you use permissions for your App. If you just use the plugins, that is not needed.
Can you explain more what is exactly not working?
Update
The time you create a page the Facebook crawler does not know yet what the Opengraph data for that one is. This will happen after the first share, but if you want to ensure it is correct from the first share on, you can force a re-scrape.
This section explains how that works:
https://developers.facebook.com/docs/sharing/opengraph/using-objects#update
When an app triggers a scrape using an API endpoint This Graph API
endpoint is simply a call to:
POST /?id={object-instance-id or object-url}&scrape=true

Accessing User 'Most Listened To' using Spotify / Echo Nest / Facebook API

I want to know if I can access a user's play history (more specifically what songs they listen to the most) for an app. The app I am building can perform the same goal with iTunes using their built-in play counter. I know Spotify uses a similar counter, but I assume for privacy concerns they don't want to deal with privacy concerns from concerned users. However, I saw a few instances where it was suggested that this task could be accomplished using Facebook's API, or Echo Nest's API. Please let me know if anyone has some constructive suggestions toward finding a way to legally obtain a particular users 'most listened to songs', or something to that effect.
SB
There's some documentation about Open Graph Music on the Facebook Developer homepage:
https://developers.facebook.com/docs/opengraph/music/
Baseline is that you only can request a User's play history if he gave you app the explicit right to read his data.
The relevant permissions would be
user_actions.music https://developers.facebook.com/docs/facebook-login/permissions/v2.1#reference-user_actions_music
user_actions:{app_namespace} https://developers.facebook.com/docs/facebook-login/permissions/v2.1#reference-user_actions__app_namespace_
Then, you should be able to request
GET /me/music.listens
according to https://developers.facebook.com/docs/reference/opengraph/action-type/music.listens/ You'll need to perform the aggregation of the most played songs/artists yourself, because there's no endpoint for that.

working with twitter API and mongodb

i am currently working on a project where i have to collect and analyze public tweets. For the collection of tweets i prefer to store them in mongodb and also, after research, i came to know that i have to build a twitter application inorder to get OAuth tokens ( http://www.sitepoint.com/twitter-1-1-oauth-php/). My question is, what does a twitter application mean here? Does it mean that only through that application i can store tweets in my mongodb?? Or does it mean that once i get these authentication tokens i can use any program(preferably ruby) to extract tweets??
Short answer: Login to https://dev.twitter.com/, create an app. In the dialog that appears, Just add an URL to any of your github repositories.
To my understanding, to use the Twitter API at all, you needed (at least in 2011) to register an app with a valid URL, however trivial the app might be. Don't know if the app itself was really validated by a Twitter employee/bot at app-registration-time, or if you just needed to provide an URL to a github repository. I don't know which other types of repository are possible.
I think, the explicit oauth mechanism requires all this. (Explation for stackexchange)
In order to present an authentication "conversation", twitter has to show your apps (that consume twitter services) an url to another app (to be found on the internet) which is linked in some way to your twitter account. So twitter can start counting the free API requests made, number of calls per hour remaining, etc.

Facebook connect/oath for a newbie

I am currently starting to research a project that wants to use Facebook instead of a log in system.
the brief needs to be able to allow users to have their own customisation settings in a user panel, and also be able to connect with facebook friends within the context of the site.
Am I barking up the wrong tree?
Also, how much of the elements we pull from facebook can be styles our way. My designers is starting concepts before I get to that point of development and I don't want to waste their time designing layouts that can not be achieved.
Facebook allows you to pull a wealth of information. The user has to OK the permission for you app to access his/her Facebook profile, but you can get friends lists and their thumbnail pictures too!
Take a look here for a start:
http://developers.facebook.com/docs/authentication/
Its a bit of work, but worth it. You can pull straight data and store it on your server. According to Facebook, you can only keep the data for 24 hours or so (If I remember correctly) so you will need to "refresh" the data every day or so.

Aggregating and displaying facebook and twitter status updates on Coldfusion Page

As an experiment I'd like to set up a coldfusion page that will pull and display the status updates from my own facebook account and twitter accounts that fall within an input date range; similar to tools like
http://orsiso.com/
http://www.threadsy.com/
and http://www.davidcramer.net/lifestream
I assume this will involve working with the facebook and twitter apis, which I have some experience with when working with mobile apps; but I've never tried to do something like this with a coldfusion page before. Eventually I'd like to pull other things like images and such, but for a first test just status updates is fine. Does anyone have sample code and/or pointers that could assist me in this endeavor? Thank you very much in advance.
Edit: I'm interested in a variant of this idea involving a database, and I've opened up a new question regarding such: Pulling facebook and twitter status updates into a SQL database via Coldfusion Page
In addition, you should check out RIAForge, which has CF code to handle both Twitter and Facebook APIs.
For Twitter see this..
http://www.stephenwithington.com/blog/index.cfm/2009/3/4/Use-ColdFusions-CFFeed-to-Display-Your-Twitter-Tweets-and-more-on-Your-Blog-in-30-Seconds
Have a look at this coldfusion wrapper for the twitter API here, really easy to set up and grab the data from your twitter feed.
I also use the twitter4j library to access my twitter account on my coldfusion site, I followed the tutorial here to get started.