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
Comment #1
FLSH commentedYeah, I would like to know this too.
Basically, something like this would have to be possible, but it doesn't work for me:
Any idea's?
Comment #2
chrisroditis commentedsame question here..any help would be appreciated
Comment #3
FLSH commentedI 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.
Comment #4
alex_b commentedbudda, does FLSH's suggestion cut it for you?
Comment #5
benced commentedIn 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
Comment #6
benced commentedCode now wrapped in an if statement so that the link isn't searched for when it don't exist
Comment #7
aron novakparser simplepie has enclosure support, at least in the recent versions
Comment #8
parrottvision commentedsubscribe
Comment #9
dman commentedFYI, 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.