Feeds module for D7 needs SimplePie support. As noted by other issues, D7 requires PHP5.3, and SimplePie 1.2 throws errors in PHP5. Although SimplePie 1.3 doesn't have a tagged release yet, the current version seems stable enough to warrant an initial patch.

For testing purposes, you can use the master branch of simplepie located at https://github.com/simplepie/simplepie

Comments

Brandonian’s picture

Status: Active » Needs review
StatusFileSize
new1.46 KB

And here is said patch. Cursory testing shows that it works well, but could use another set of eyes.

Brandonian’s picture

Assigned: Brandonian » Unassigned

bump

dqd’s picture

need time here to set up. will test. thx!

Brandonian’s picture

bump. I've been using a patched version of this on my personal site for about a month now without any adverse affects.

Brandonian’s picture

Another bump. This is working well on two sites that I maintain. I can't change the status myself, but somebody should look at this. It's a ridiculously simple patch, and should be an easy one to check.

MrNeko’s picture

@Brandonian Can I know how to get this to work? Apply the patch at #1 and copy simplepieautoloader.php to feeds/libraries?

Brandonian’s picture

@MrNeko, thanks for wanting to take a look. Here's an easy way to test it.

  1. Download the SimplePie library and place the folder contents in "sites/all/libraries", so that the path to the autoloader file is "sites/all/libraries/simplepie/SimplePieAutoloader.php"
  2. Apply the patch to Feeds found in #1.
  3. Create a new Feed importer with the now exposed SimplePie parser.
  4. To test, try importing a feed with enclosures. You can use my Flickr feed if you'd like.
  5. Profit!
ndeschildre’s picture

I can confirm it works, and images are correctly imported in filefields, following instructions from #7.

Brandonian’s picture

Status: Needs review » Reviewed & tested by the community

Yah! Per #8, marking as reviewed/tested.

MrNeko’s picture

Sorry forgot to post this back. Been using this on my site for 2 months now and it's working. Grabbing enclosures just fine.

However, I would like to parse an image in the description to an image field. Is it possible?

Sadly, I have no idea about php and simplepie. Is it something along the line of ..

function get_first_image_url($html)
{
if (preg_match('/ < img.+?src="(.+?)"/', $html, $matches)) {
return $matches[1];
}
else return 'default. jpg';
}

franz’s picture

MrNeko, I think you can use Feeds Tamper

franz’s picture

Status: Reviewed & tested by the community » Needs review

Don't we need this to be backwards compatible? Maybe it's ok to require Simple Pie 1.3 and remove support for 1.2 ... Just wondering.

twistor’s picture

Status: Needs review » Needs work
StatusFileSize
new6 KB

Here's an initial go. I'm not too happy yet, but I think we need to support old versions. Also, this uses the single file download, rather than the autoloader business.

twistor’s picture

Status: Needs work » Patch (to be ported)

Simplepie 1.3 has been stabilized, so I added this. Feeds now supports the older, <= 1.2 simplepie.inc and the newer simplepie.mini.php and simplepie.compiled.php.

Should we backport this?

Rob_Feature’s picture

When trying to import using the dev version (and simplepie 1.3) I get:

Notice: Undefined variable: file in FeedsEnclosure->getFile() (line 384 of /sites/all/modules/contrib/feeds/plugins/FeedsParser.inc).

Not sure if this is a problem with the update or with my feed...

This looks like it happens from an invalid enclosure...so it looks particular for my feed source.

twistor’s picture

Have you tried the latest version?

lyricnz’s picture

Status: Patch (to be ported) » Needs review
StatusFileSize
new1009 bytes

Reimplemented using current dev code which does most of the work for us, including supporting the 1.2 versions.

Simply drop autoloader.php and the library directory from simplepie 1.3 into sites/all/libraries/simplepie (or similar), and apply patch.

(FWIW, it would actually work without any patch at all, if you renamed autoloader.php to simplepie.inc!)

js’s picture

I recall reading comments in the past that common_syndication_parser was preferred to SimplePie.

With 1.3 released, would that still be true?

lyricnz’s picture

Does it matter?

js’s picture

I am guessing that most users would like to make the best choice. It is certainly the first question I had. If there are choices, how to select?

In my case I have performance concerns due to scale and am thinking of moving the functionality out of the main site, either into another site, or separate code, and push the results, post processing. It would likely be easier to use SimplePie in its own project, but I was asking for help, from the experience of others, before going down this path.

lyricnz’s picture

Good question, but offtopic for this issue.

mrP’s picture

+1 RTBC #17

twistor’s picture

Version: 7.x-2.x-dev » 6.x-1.x-dev
Status: Needs review » Patch (to be ported)
twistor’s picture

Issue summary: View changes

Added Simplepie info.

twistor’s picture

Version: 6.x-1.x-dev » 7.x-2.x-dev
Issue summary: View changes
Status: Patch (to be ported) » Closed (fixed)

If anyone feels like porting to 6.x. Feel free.