Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#39 | feeds-952878.patch | 3.22 KB | longlivelance |
#24 | feeds-952878-24.patch | 3.21 KB | xcf33 |
#23 | encosure_support-952878-23.patch | 3.11 KB | exlin |
#9 | feeds__enclosure_tag_support__952878__9.patch | 3.21 KB | slashrsm |
| |||
#8 | feeds__enclosure_tag_support__952878__8.patch | 3.23 KB | slashrsm |
|
Comments
Comment #1
alex_b CreditAttribution: alex_b commentedCommon 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.
Comment #2
mchelensubscribing
Comment #3
Demura Egor CreditAttribution: Demura Egor commentedIs any module currently exist for import RSS enclosures or maybe other ways of solving this problem?
Comment #4
geerlingguy CreditAttribution: geerlingguy commentedSubscribe - 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...
Comment #5
Mark TrappThis 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.
Comment #6
geerlingguy CreditAttribution: geerlingguy commentedI 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.
Comment #7
slashrsm CreditAttribution: slashrsm commentedThis 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.
Comment #8
slashrsm CreditAttribution: slashrsm commentedI removed some unneeded whitespace.
Comment #9
slashrsm CreditAttribution: slashrsm commentedPatch from #9 fixed a bit.
Comment #10
paulgemini CreditAttribution: paulgemini commentedsubbing
Comment #11
rkarajgi CreditAttribution: rkarajgi commentedI 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.
Comment #12
slashrsm CreditAttribution: slashrsm commentedTry
Comment #13
rkarajgi CreditAttribution: rkarajgi commentedThanks for your help - it worked.
Comment #14
paulgemini CreditAttribution: paulgemini commentedCan we move this to tested by the community?
Comment #15
Dave ReidNew features like this will surely need tests to ensure they work and stay working.
Comment #16
mefisto75 CreditAttribution: mefisto75 commentedtagging
Comment #17
MrNeko CreditAttribution: MrNeko commented@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?
Comment #18
Brandonian CreditAttribution: Brandonian commentedNote that with #1222750: SimplePie 1.3 support, you can get enclosure support through the SimplePie library.
Comment #19
janip CreditAttribution: janip commentedThe patch in comment #9 worked for me, thank you!
Comment #20
Ninjansson CreditAttribution: Ninjansson commentedI 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.
Comment #21
Jorrit CreditAttribution: Jorrit commentedI suggest that the key in the result item is called
enclosures
instead ofenclosure
. This matches the key that the SimplePie parser uses. Also, perhaps theFeedsEnclosure
class can be used such that the mime type is saved.Comment #22
lyricnz CreditAttribution: lyricnz commented@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.
Comment #23
exlin CreditAttribution: exlin commentedThis patch is fixed agains branch 1033202-entity-processor.
Comment #24
xcf33 CreditAttribution: xcf33 commentedRe-rolled #9 against 7.x-2.x-dev,
Good work Janez :)
Comment #25
slashrsm CreditAttribution: slashrsm commentedHeh... this is a VERY old patch of mine :)
Comment #26
Dave Cohen CreditAttribution: Dave Cohen commentedI 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.
Comment #27
heivoll CreditAttribution: heivoll commentedThe 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.
Comment #33
Christopher Riley CreditAttribution: Christopher Riley commentedCould we get this cleaned up so it could get committed?
Comment #34
MegaChriz CreditAttribution: MegaChriz as a volunteer commented@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.
Comment #35
Christopher Riley CreditAttribution: Christopher Riley commentedI just grabbed the latest dev and the patch applies clean. Scheduled a test lets see what it does.
Comment #37
Christopher Riley CreditAttribution: Christopher Riley commentedIt 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
Thanks
Comment #38
MegaChriz CreditAttribution: MegaChriz as a volunteer commented@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.
Comment #39
longlivelance CreditAttribution: longlivelance commentedHere is a reroll from 7.x-2.0-beta3 for anyone else who needs it.
Comment #40
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedThe patch applies. Now we still need tests.
Comment #41
OlafskiI 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.
Comment #42
Christopher Riley CreditAttribution: Christopher Riley commentedIt has been a while and this patch does the job. Any possibility of it getting cleaned up and committed?
Comment #43
MegaChriz CreditAttribution: MegaChriz as a volunteer commented@Christopher Riley
Do you want to write a test for this feature? The latest patch also seems to break something else.
Comment #44
MegaChriz CreditAttribution: MegaChriz as a volunteer commentedBlog post about this feature: https://bkosborne.com/blog/importing-images-within-rss-feed-using-drupal...