social-feed

aggregates social media feeds

Usage no npm install needed!

<script type="module">
  import socialFeed from 'https://cdn.skypack.dev/social-feed';
</script>

README

Social Feed

Aggregates data from multiple social feeds

Configuration

Create a config.js file that looks like the following:

module.exports={
    twitter:{
        path:'/1.1/statuses/user_timeline.json?screen_name=screenName',
        clientId:'clientIdclientId',
        clientSecret:'clientSecretclientSecretclientSecret'
    },
    facebook:{
        appID:'appID',
        appSecret:'appSecret',
        path:'/someusername/feed',
        accessToken:'facebookAccessToken'
    },
    youtube:{
        url:'/feeds/api/users/someUser/uploads?v=2&alt=json'
    },
    flickr:{
        consumerKey : 'consumerKey',
        consumerrecret : 'consumerSecret',
        userId : 'userId',
        userKey : 'userKey',
        userSecret : 'userSecret'
    },
    blog:{
        host:'domain.com',
        path:'/feeds/posts/default?alt=json'
    }
};

SocketIO example

On the server...

var io = require('socket.io').listen(3031,{log:false});
var feeds = require('social-feeds'), feed={};

feeds.getFeeds(feed);
setInterval(function(){
    feeds.getFeeds(feed);
}, 5000);

io.sockets.on('connection', function (socket) {
    socket.on('refreshRequested', function (data) {
        socket.emit('feedUpdate', feed);
    });
    setInterval(function() {
        socket.emit('feedUpdate', feed);
    }, 5000 );
});

And on the client...

<script src="http://127.0.0.1:3031/socket.io/socket.io.js"></script>
<script>
    var socket = io.connect('http://localhost:3031');
    socket.on('feedUpdate', function (data) {
        console.log(data);
    });
</script>