I've got a family site where I'm bringing in lots of family members' blogs to the site. Many of them don't really know how to properly blog, and lots of times leave titles out. When they do, and the first thing that's in their post is an image or a link, that ends up becoming the title when pulled into Drupal using FeedAPI. I've made a small change my the code I'm using to get the first three real words, not just characters, and it's working nicely. Might I suggest the same for the module?

Change line 252 and 253 from:

        $words = preg_split("/[\s,]+/", $feed_item->description);
    $node->title = $words[0] .' '. $words[1] .' '. $words[2] ;

to

        $words = preg_split("/[\s,]+/", strip_tags($feed_item->description));
    $node->title = $words[0] .' '. $words[1] .' '. $words[2] .'...';

Comments

mustafau’s picture

Version: 5.x-1.2 » 6.x-1.x-dev
Status: Active » Needs review

Seems good to me.

For D6 those are lines 261, 262 of feedapi_node.module.