Git Product home page Git Product logo

hyve's Introduction

Hyve

http://github.com/Tawlk/hyve

About

Hyve (pronounced: "hive") is a Javascript library aiming to be a general solution for streaming the latest data from multiple social media networks, for any given topic, and abstracting all of them into one simple API.

Current Features

  • Plays nice with all major JS frameworks (jQuery, Mootools etc.)
  • Can run any Javascript function of your choice against each posting retrieved.
  • Outputs all data in a normalized format - USMF
  • Supports searching Facebook, Twitter, Identica, Foursquare, Flickr, Picasa, Wordpress, Youtube, Reddit, Digg, and Delicious
  • Indirectly supports Imgur and Vimeo by catching links shared via other services.
  • Expands urls from t.co and bitly
  • Streams from all services (default), or optionally only selected services
  • Streams personal feed of subscriptions using Oauth tokens (for supported networks)
  • Runs in the browser or on the server (Node.js)

Requirements

For running Hyve in Node.js, you'll need the request library.

You can grab it from npm:

$ npm install request

For running Hyve in the browser in production you'll need to compile it with the grunt library.

You can grab it from npm:

$ npm -g install grunt

Usage

Configuration Options

Data Queueing

When this is enabled all incoming data will be placed into a FIFO queue by so your application can dequeue items as appropriate.

Queued items will be stored in 'hyve.queue' as an array:

console.log(hyve.queue)

>>> {'text':[],'link':[],'video':[],'image':[],'checkin':[]}

Enable Queuing:

hyve.queue_enable = true

Dequeue Queued Item:

var item = hyve.queue.text[0]

hyve.dequeue(item)

Data Recall (Browser Only)

If enabled in conjunction with hyve.queue hyve will cache all queued items using HTML5 localStorage. Hyve will recall any cached items if the page containing hyve is closed and restarted.

Enable Recall:

hyve.recall_enable = true

API Key requirements

In order to use some functions within some services you must supply API Keys.

Foursquare will only return data if the client has HTML5 Geolocaton support. You must also define client_id and client_secret like so:

hyve.feeds.foursquare.client_id = 'your_application_client_id'
hyve.feeds.foursquare.client_secret = 'your_application_client_secret'

Flickr will work without authentication, however the 'views' statistic is not returned without auth. Without 'views' the 'weight' metric will be set to 0.

To get 'views' in Flickr you must specify an API key like so:

hyve.feeds.flickr.api_key = 'your_api_key',

To utilize bitly url un-shortening you must supply a username and API key:

hyve.feeds.bitly.login = 'your_username'
hyve.feeds.bitly.api_key = 'your_api_key'

OAuth Token definitions

In order to use functions of hyve that require OAuth authentication (like the friends/subcriptions stream) you must supply OAuth tokens for each involved service. Obtaining OAuth tokens is outside the scope of hyve.

// Facebook (Oauth2)
hyve.feeds.facebook.oauth_token = 'oauth_token'

// Flickr (Oauth2)
hyve.feeds.flickr.oauth_token = 'oauth_token'

// Youtube (Oauth2)
hyve.feeds.youtube.oauth_token = 'oauth_token'

// Twitter (Oauth1a)
hyve.feeds.twitter.oauth_token = 'oauth_token'
hyve.feeds.twitter.oauth_consumer_key = 'oauth_consumer_key'
hyve.feeds.twitter.oauth_signature = 'oauth_signature'
hyve.feeds.twitter.oauth_nonce = 'oauth_nonce'
hyve.feeds.twitter.oauth_timestamp = 'oauth_timestamp'

// Instagram (Oauth2)
hyve.feeds.instagram.access_token = 'access_token'

Commands

Public search real-time stream

hyve.search.stream(search_terms,callback_function,optional_service_list)

Public recently popular search

hyve.search.popular(search_term,callback_function,optional_service_list)

Personal friends/subscriptions stream

hyve.friends.stream(callback_function,optional_service_list)

Stop running streams

hyve.stop()

Deployment

Browser - Production

For production use in a browser you should use a single-file minified version of hyve.

Compile using grunt:

$ grunt concat min

You will then find a minified version of hyve at dist/hyve.min.js

Browser - Development

During development you can simply source the files you intend to work with:

<script type="text/javascript" src="hyve/src/hyve.core.js">
<script type="text/javascript" src="hyve/src/hyve.twitter.js">
<script type="text/javascript" src="hyve/src/hyve.facebook.js">

Node.JS

In Node.js simply require hyve.core.js and any modules you need.

var hyve = require('src/hyve.core.js')
require('src/hyve.twitter.js')
require('src/hyve.facebook.js')

Examples

Simple echo of Twitter, Facebook, and Identica with pure JS:

var myFunction = function(data){console.log(' + data.service +' : '+ data.text  +')}
var myQuery = 'android'
var myServices = ['Twitter','Facebook','Identica']

hyve.search.stream(myQuery,myFunction,myServices)

Simple Node.js example to output data from all services:

var hyve = require('src/hyve.core.js')
require('src/hyve.twitter.js')
require('src/hyve.facebook.js')

hyve.stream('android', function(data){
    console.log(data.service +' : '+ data.text);
})

Basic live search engine with jQuery:

<!DOCTYPE HTML>
<html>
    <head>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
        <script src="dist/hyve.min.js" type="text/javascript"></script>
        <script type="text/javascript">
            $(document).ready(function() {
                $('#search').bind("click",function(){
                    query=$('#query').val();
                    hyve.search.stream(query,function(data){
                        $('#output').prepend($('<p>' + data.service +' : '+ data.text  +'</p>'))
                    });
                });
            });
        </script>
    </head>
    <body>
        <div id="input">
            <input id="query" type="text" />
            <button id="search">search</button>
        </div>
        <div id="output"></div>
    </body>
</html>

You can find more examples in the demos directory.

Notes

Questions/Comments? Please check us out on IRC via irc://freenode.net/#tawlk

hyve's People

Contributors

lrvick avatar tsoporan avatar robotlolita avatar insin avatar

Stargazers

 avatar Mauricio Uribe avatar IGB avatar Jason Todd avatar Jimm avatar Geoff Rothman avatar Ashley Donald avatar Alex Neumann avatar Lukas Sekerak avatar Angga avatar Daniel Sousa avatar  avatar CuriousKitty avatar Praggie avatar Antonio Anderson Souza avatar Dany Laksono avatar Yifu Guo avatar Alberto Berti avatar Jonathan Barratt avatar Charlie Madison avatar Adithep Srinarula avatar Soravis Prakkamakul avatar Smrutiranjan Sahu avatar AJ Seelund avatar Andrew Shaffer avatar Christoph Labacher avatar Alexey Novikov avatar spencer pope avatar Michael Anthony avatar Gustavo RPS avatar  avatar Farhan Syed avatar me avatar Arsalan Ahmad avatar Edward Chan Jia Wei avatar Nelson Wylie avatar Sim avatar Joe Verderber avatar Ryan Bennett avatar Alex T avatar  avatar Sébastien Lerique avatar Mike McAlpin avatar Lucas Dino Nolte avatar Sparky avatar Alexandre Trilla avatar Nicholas Bardy avatar Luqmaan Dawoodjee avatar  avatar Ryan Dick avatar jbzurn avatar Alex Mingoia avatar Daniel Machado Fernández avatar Daniel Preotiuc avatar Daniel  avatar  avatar j-j.eth avatar Ron Hornbaker avatar Clément Renaud avatar Richard Hoffmann avatar Karambir Singh Nain avatar Hassan Seguias avatar Gerard McDonald avatar Sohail Prasad avatar  avatar Chris Witko avatar Ahmad Assaf avatar Phillip Jacobs avatar Kevin Western avatar  avatar  avatar JT5D avatar  avatar Juan E. D. avatar  avatar  avatar Mike Greenberg avatar Gabe Martin avatar Daniel avatar  avatar Flaviu Simihaian avatar  avatar S. Christoffer Eliesen avatar Wei Xie avatar Eric Martindale avatar Kirk Scheibelhut avatar Klaut avatar Stuart Powers avatar José Padilla avatar Kenny avatar Gary Rafferty avatar  avatar Umit Kitapcigil avatar Sofia avatar Donovan Preston avatar Raj Kadam avatar Thomas Knoll avatar Lance Pollard avatar Amr Tamimi avatar Adam Burmister avatar

Watchers

David Pflug avatar Ankur Mathur avatar  avatar James Cloos avatar Daniel Preotiuc avatar jbzurn avatar Regi Ellis avatar Thien-Bach Huynh avatar Nicholas Bardy avatar Danny Grove avatar Michael Anthony avatar Stephen Hnilica avatar edwardttril avatar AJ Seelund avatar Joe Verderber avatar Sufi avatar  avatar  avatar

hyve's Issues

Twitter failing causes hyve to fail

hyve.callbacks.f3(
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
  <head>
    <title>503 Service Unavailable</title>
  </head>
  <body>
    <h1>Error 503 Service Unavailable</h1>
    <p>Service Unavailable</p>
     <h3>Guru Meditation:</h3>
    <p>XID: 2892298606</p>
    <address>
       <a href="http://www.varnish-cache.org/">Varnish</a>
    </address>
  </body>
</html>
);

Issues with Foursquare?

Attempting for formulate a request for foursquare via browser page.
Was getting a "services is empty" so started looking through hyve.foursquare.js.
Since the geo change, I don't think there was an addition to geo within hyve.core.js
Also, are there some spelling errors that are causing issues or am I not looking at the code correctly.
Line 12 on hyve.foursquare.js has "feed_urls :{" though on line 17, it asks for "options.feed_url,".

Lastly, maybe I am formulating the request incorrectly.
I attempted hyve.geo.stream("query here", function(data){console.log(data)});
as well as hyve.search.stream("query here", function(data){console.log(data)}); with no luck.
On the same page I also included hyve.feeds.foursquare.client_id and hyve.feeds.foursquare.client_secret.

Thanks

USMF and threaded comments

Heya,

I was wondering what your take was on USMF and threaded comments.

I would like to imagine that every comment in a threaded comment system might get its own USMF instance, but in its current form USMF doesn't seem to allow for any notion that a given comment is in reply to another comment.

Perhaps this is more general, could each USMF object potentially be "in reply" to some other object? This tag could be something like: "in_reply_to" or "replies_to". Of course the question then becomes how that other object would be referred two. Instead of some unique non-service related USMF id perhaps the replies_to entry could be something like:

"replies_to" : {
  "service": "",
  "id": ""
}

This would account for: threaded youtube comments, facebook comments, twitter replies (which are sometimes held in the twitter object), reddit comments being related to reddit posts, reddit comments replying to each other etc.

what do you think?

Licensing?

Hi there ! Thanks for the awesome job.
I want to use hyve in a research project called Social Brain where we anatomize collective intelligence through massive SNA of social networks stream. Hyve ans USMF turns up very relevant and useful ! Just wondering about the license you have chosen, as there is no clear indication about that.
Cheers

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.