WordPress.org

Ready to get started?Download WordPress

Forums

Facebook Feed Grabber
[resolved] Only feed videos (8 posts)

  1. alsc
    Member
    Posted 1 year ago #

    Is it possible to grab only videos from the feed and show in wordpress?

    http://wordpress.org/extend/plugins/facebook-feed-grabber/

  2. bonnerl
    Member
    Plugin Author

    Posted 1 year ago #

    It should be possible. I couldn't tell you off the top of my head how to. You would have to get dirty by messing with some code. Which means every time I update the plugin at this point you'd have to update the new plugin file if you were to update.

    If you want to tackle it then have a look through Facebook's Graph API. They also have an API Explorer where you can test API calls without messing with code.

    The portion of my code that calls Facebook is located in the facebook.php file; lines 476 through 489. More specifically the two lines containing '/'. $feed_id .'/feed?date_format=U'. The first one if you're using caching; the second if you are not. If the only feed you're displaying is with videos then you could simply change the before mentioned code. If you need to be able to go both ways then add a arguments array that you set to true when you want to limit it to videos.

    // Get the feed (maybe it's cached?)
    if ( $cache_feed != 0 ) {
    
    	// Include cache class
    	include_once 'caching.php';
    
    	// Initiate class
    	$cache = new ffg_cache();
    
    	// Let it do it's magic. (Will return the needed content)
    	$content = $cache->theMagic(&$this, '/'. $feed_id .'/feed?date_format=U', (($cache_feed * 60)));
    
    } else
    	$content = $this->facebook->api('/'. $feed_id .'/feed?date_format=U');
  3. alsc
    Member
    Posted 1 year ago #

    Thank you for the fast answer. I will look into it.

  4. bonnerl
    Member
    Plugin Author

    Posted 1 year ago #

    No, problem. Just happened to check and see if anyone had posted anything related to my plugin.

    I had another thought for how to limit it to just videos. This option would retrieve the normal data then just skip anything not labeled as a video. The downside to this one is that if there aren't any videos in the portion of the feed that it loads it won't have anything to display.

    The actual code to add would be added to after the foreach starts on line 521 of the current facebook.php file.

    foreach($content['data'] as $item) {//this is currently on line 521
    
    	// You would add one of the following if statements.
    
    	// If you want to limit all feeds displayed
    	if ( $item['type'] != 'video' )
    		continue;
    
    	// If you only want to limit specific feeds by adding an a value to the args array with the key "video_only"
    	if ( $video_only == true && $item['type'] != 'video' )
    		continue;

    Every feed item has a type associated with it, I'm not sure what all is currently out there. I've got the plugin set up to not be based on the type.

  5. gereby
    Member
    Posted 1 year ago #

    hmm, i wonder, wheter there is an easy way to filter the feed. i don't want every little status, but only those, that contain a message ("<p class='message'>")?

  6. mtamony
    Member
    Posted 1 year ago #

    I agree with above. This plugin is awesomely simple but I'd like it to just display the news entered into facebook page rather than "....is now friends with"
    Example is http://test.edwardcolver.com/blog/

  7. bonnerl
    Member
    Plugin Author

    Posted 1 year ago #

    The next release will remove the "John Doe is now friends with Jane Doe" statuses. Hopefully later this week.

  8. bonnerl
    Member
    Plugin Author

    Posted 1 year ago #

    I just release 0.8.1 which filters these status out. Will be available when wordpress lets the update release.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags