I'm currently setting up a Feeds importer using the HTTP fetcher, Common syndication parser, and Node processor, but it doesn't look like RSS enclosures (or MediaRSS) are supported at all in FeedsParser, its subclasses or _parser_common_syndication_RSS20_parse().

Is enclosure/MediaRSS support in the pipeline, or is there another project that adds enclosure/MediaRSS support? if not, I'll see what I can do to provide a patch for this.

Members fund testing for the Drupal project. Drupal Association Learn more


alex_b’s picture

Common Syndication Parser does not support enclosures atm, I'd appreciate a patch for it. SimplePie parser does support enclosures out of the box.

On a more long term note, SimplePie is not as well maintained as it used to be, Common Syndication Parser could use a rewrite, most likely as an independent project.

mchelen’s picture


Demura Egor’s picture

Category: feature » task

Is any module currently exist for import RSS enclosures or maybe other ways of solving this problem?

geerlingguy’s picture

Subscribe - can't get SimplePie parser to work with my feed's enclosures.

How should they be formatted? I have them set to go to an imagefield on one of my content types...

Mark Trapp’s picture

This could actually be closed as works as designed, at least in Drupal 7. I've been able to handle enclosures and Media RSS elements without an issue using Feeds XPath Parser: just map an XPath query for an enclosure or Media RSS element to a file or image field and It Just Works™: the linked image is copied to the files directory and added to the field.

geerlingguy’s picture

I guess I'll try using XPath Parser; haven't yet tried it on anything, and I thought Feeds core was said to work with SimplePie.

slashrsm’s picture

Status: Active » Needs review
3.26 KB

This patch adds support for enclosure tag to RSS and Atom (link tag with rel="enclosure"). I also corrected _parser_common_syndication_link(), which was returning wrong item URL if also enclosure link existed in same item.

slashrsm’s picture

I removed some unneeded whitespace.

slashrsm’s picture

Patch from #9 fixed a bit.

paulgemini’s picture


rkarajgi’s picture

I am trying to apply this patch - but it does not apply. I presume the patch is for the feeds module itself. It looks like the patch expects the folder name to be "a" for the feeds module and it should be applied from outside folder.

slashrsm’s picture


patch -p1 < /path/to/patch
rkarajgi’s picture

Thanks for your help - it worked.

paulgemini’s picture

Status: Needs review » Reviewed & tested by the community

Can we move this to tested by the community?

Dave Reid’s picture

Status: Reviewed & tested by the community » Needs work

New features like this will surely need tests to ensure they work and stay working.

mefisto75’s picture


MrNeko’s picture

@slashrsm I applied the patch but couldn't get it to grab images from rss feeds.

My target is an image filefield. Is there anything I have done wrongly here?

Brandonian’s picture

Note that with #1222750: SimplePie 1.3 support, you can get enclosure support through the SimplePie library.

janip’s picture

The patch in comment #9 worked for me, thank you!

Ninjansson’s picture

I can't get this to work. What kind of field should I use as a target for the enclosure source? I have tried with file, image and a regular text field but nothing works.

Jorrit’s picture

I suggest that the key in the result item is called enclosures instead of enclosure. This matches the key that the SimplePie parser uses. Also, perhaps the FeedsEnclosure class can be used such that the mime type is saved.

lyricnz’s picture

@Ninjansson: you must remember that the feed itself only contains a URL, not an actual file, so file/image won't work (you would need to *download* the file from the URL then use that in the image field). I use SimplePie 1.3 and a Link field quite successfully.

exlin’s picture

This patch is fixed agains branch 1033202-entity-processor.

slashrsm’s picture

Heh... this is a VERY old patch of mine :)

Dave Cohen’s picture

Issue summary: View changes

I realize this is an old thread.

I find the patch #24 works as intended. RTBC IMHO.

However, while that patch succeeds in extracting the just the url attribute of an enclosure, I'd like to capture all the markup of the enclosure. That is, I'd like the entire enclosure tag with all its attributes and all its content. Similar to how the description is captured, i.e. HTML text.

I'm not well versed in feeds, simplexml, etc. Can someone point me to how to get that complete enclosure markup from a feed? If so, thanks.

heivoll’s picture

Status: Needs work » Needs review

The patch in #24 was created three years ago, but still works like it should. As far as I can tell, there aren't many reasons this hasn't been included in any releases?
Marking it as "Needs review", with a note that it does work for me in version 7.x-2.0-beta1.

The last submitted patch, 7: feeds__enclosure_tag_support__952878__7.patch, failed testing.

The last submitted patch, 8: feeds__enclosure_tag_support__952878__8.patch, failed testing.

The last submitted patch, 9: feeds__enclosure_tag_support__952878__9.patch, failed testing.

The last submitted patch, 23: encosure_support-952878-23.patch, failed testing.

Status: Needs review » Needs work

The last submitted patch, 24: feeds-952878-24.patch, failed testing.

Christopher Riley’s picture

Could we get this cleaned up so it could get committed?

MegaChriz’s picture

@Christopher Riley
I guess so, if the patch is updated for the latest dev and if there is an automated test for the added feature.

Christopher Riley’s picture

I just grabbed the latest dev and the patch applies clean. Scheduled a test lets see what it does.

The last submitted patch, 24: feeds-952878-24.patch, failed testing.

Christopher Riley’s picture

It appears that it is failing because the feed that it is being tested against does not exist. How do we go about having it test against a valid feed such as http://www.rssboard.org/files/example-multiple-enclosures.xml


MegaChriz’s picture

Issue tags: +Needs reroll

@Christopher Riley
No, I don't think the patch in #24 is failing because of an URL that is no longer available. On February 5, 2016 it failed because the patch appearantly caused that the URL of item 1 of feeds/tests/feeds/earthquake-georss.atom wasn't correctly parsed. The latest test failure is that the patch does not apply anymore. So it needs at least a reroll.

For the automated test it would be a good idea to have a good sample file like the one you posted. Tests shouldn't rely on external URLs being available though, so for the automated test the sample file needs to be added to feeds/tests/feeds folder.

longlivelance’s picture

Here is a reroll from 7.x-2.0-beta3 for anyone else who needs it.

MegaChriz’s picture

Issue tags: -Needs reroll +Needs tests

The patch applies. Now we still need tests.

Olafski’s picture

I just applied the patch of #39 to a site using Feeds 7.x-2.0-beta4 and confirm that I was able map the *enclosure* of an external feed to the URI of an image field. The import worked then as expected.

Christopher Riley’s picture

It has been a while and this patch does the job. Any possibility of it getting cleaned up and committed?

MegaChriz’s picture

@Christopher Riley
Do you want to write a test for this feature? The latest patch also seems to break something else.

MegaChriz’s picture