GithubHelp home page GithubHelp logo

social-feed's Introduction

SocialFeed

Get feeds from different social networks in a unified format

Install

Use composer: composer require codeurs/social-feed

Features

  • Get the most recent posts of a user
  • Get a specific item based on an ID
  • Implemented media: Twitter, Facebook, Instagram
  • Returns items in simple format
  • Gets information (id, service, thumbnail) on attached video/images from: youtube, vine, instagram, vimeo
  • Get an id from an url of a post

Example

Facebook

$feed = new SocialFeed();

// Input api credentials
$feed->facebook->setCredentials([
  'app_id' => '__',
  'app_secret' => '__'
]);

// Get all recent posts for user 'codeurs.be'
$data = $feed->facebook->getFeed('codeurs.be');
foreach ($data as $item) {
  // ...
}

// Get a single facebook post
$item = $feed->facebook->getItem('646338148755451_704084252980840');

// Get an id or item from a facebook url
$id = $feed->facebook->getIdFromUrl('https://www.facebook.com/_/photos/_/?type=1&theater');
$item = $feed->facebook->getItemFromUrl('https://www.facebook.com/_/photos/_/?type=1&theater');

Output

Output returns the following format (as a php object; printed as json for readability):

{
  "service": "facebook",
  "text": "Example.",
  "link": "https://www.facebook.com/____",
  "id": "_",
  "created": 1428764403,
  "user": {
    "id": "_",
    "image": "https://graph.facebook.com/v2.3/_/picture/",
    "name": "_",
    "handle": null,
    "link": "https://facebook.com/profile.php?id=_"
  },
  "media": {
    "image": "https://graph.facebook.com/_/picture?type=normal",
    "video": null
  }
}

If a video is present, information will be available in media.video:

{
  "image": null,
  "video": {
    "service": "youtube",
    "id": "_",
    "image": "http://img.youtube.com/vi/_/hqdefault.jpg"
  }
}

Credentials

The following credentials are needed depending on the medium:

  • Facebook: app_id, app_secret
  • Twitter: consumer_key, consumer_secret, access_token, access_token_secret
  • Instagram: client_id, client_secret

social-feed's People

Contributors

benmerckx avatar

Watchers

James Cloos avatar Starbuck avatar

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.