Its currently impossible to use enclosure data with the simplepie parser because the additional data is not provided in the $feed_item as passed in to the function feedapi_item_feedapi_item_save().

What would the correct method for handling RSS enclosures be?

Example url for testing http://youtube.com/rss/global/top_viewed_week.rss

Comments

FLSH’s picture

Yeah, I would like to know this too.

Basically, something like this would have to be possible, but it doesn't work for me:

 if ($author = $simplepie_item->get_author()) {
  $curr_item->options->original_author = $simplepie_author->get_email();
}

Any idea's?

chrisroditis’s picture

same question here..any help would be appreciated

FLSH’s picture

Status: Active » Needs work

I found a solution to this problem. It isn't pretty, but it works..

In parser_simplepie.module, search for the following code:

$curr_item->options->tags = $tags;

And add this after that:

$curr_item->simplepie_item = $simplepie_item;

This imports all the itemdata simplepie can get.

Now you can edit the feedapi_node.module

You can now get the enclosed thumbnail data using $feed_item->simplepie_item->get_enclosure()->get_thumbnail()

Example:

search for '$node->body = $feed_item->description;' (in feedapi_node.module) and add the following code beneath that line:

$node->body = $feed_item->simplepie_item->get_enclosure()->get_thumbnail();

This puts the thumbnail in your node body. If you want to put the data in cck fields, use this:

$node->field_thumbnail = array(array('value' => $feed_item->simplepie_item->get_enclosure()->get_thumbnail());

Where 'field_thumbnail' is the cck fieldname.

alex_b’s picture

budda, does FLSH's suggestion cut it for you?

benced’s picture

Component: Code » Code parser_simplepie

In between line 188 and 189 in the simple parser module I added this

$curr_item->enclosure_link = $simplepie_item->get_enclosure()->get_link();

Now I can map this using the mapping interface to map the link to the enclosure item wherever

Only problem with FLSH method on my site is there is too much data and it takes so much memory that it goes way beyond my php memory limit and brings up and error screen

Perhaps use snippets like the one above but give them switchboxes to switch them on and off from an admin settings view

benced’s picture

Code now wrapped in an if statement so that the link isn't searched for when it don't exist

if (is_array($enclosures)) {
    $curr_item->enclosure_link = $simplepie_item->get_enclosure()->get_link();
    }
aron novak’s picture

Version: 5.x-0.x-dev » 6.x-1.x-dev
Status: Needs work » Closed (fixed)

parser simplepie has enclosure support, at least in the recent versions

parrottvision’s picture

subscribe

dman’s picture

FYI, I spent a few hours with simplePie, and then with E-Parser trying to find why they were not supplying enclosures properly. I ended up tweaking parser_simplepie code myself also.
Yes, even using the 'latest' version simplepie just gave me a blob that could not be transferred into a textfield usefully.

BUT
Still unsatisfied, I just tried feedapi_parser_exhaustive which just works! And in a way I expected.
You get ALL the possible values that could be found in the feed, regardless of namespace, so you just pick the value you want and put it where you want!
Just making a note, because I found this question in my searches, so maybe the next seeker can try this.