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 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 commentedIs any module currently exist for import RSS enclosures or maybe other ways of solving this problem?
Comment #4
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 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 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 commentedI removed some unneeded whitespace.
Comment #9
slashrsm commentedPatch from #9 fixed a bit.
Comment #10
paulgemini commentedsubbing
Comment #11
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 commentedTry
Comment #13
rkarajgi commentedThanks for your help - it worked.
Comment #14
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 commentedtagging
Comment #17
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 commentedNote that with #1222750: SimplePie 1.3 support, you can get enclosure support through the SimplePie library.
Comment #19
janip commentedThe patch in comment #9 worked for me, thank you!
Comment #20
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 commentedI suggest that the key in the result item is called
enclosuresinstead ofenclosure. This matches the key that the SimplePie parser uses. Also, perhaps theFeedsEnclosureclass can be used such that the mime type is saved.Comment #22
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 commentedThis patch is fixed agains branch 1033202-entity-processor.
Comment #24
xcf33 commentedRe-rolled #9 against 7.x-2.x-dev,
Good work Janez :)
Comment #25
slashrsm commentedHeh... this is a VERY old patch of mine :)
Comment #26
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 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 commentedCould we get this cleaned up so it could get committed?
Comment #34
megachriz@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 commentedI just grabbed the latest dev and the patch applies clean. Scheduled a test lets see what it does.
Comment #37
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@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 commentedHere is a reroll from 7.x-2.0-beta3 for anyone else who needs it.
Comment #40
megachrizThe 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 commentedIt has been a while and this patch does the job. Any possibility of it getting cleaned up and committed?
Comment #43
megachriz@Christopher Riley
Do you want to write a test for this feature? The latest patch also seems to break something else.
Comment #44
megachrizBlog post about this feature: https://bkosborne.com/blog/importing-images-within-rss-feed-using-drupal...
Comment #45
bluegeek9 commentedDrupal 7 reached end of life and the D7 version of Feeds is no longer being developed. To keep the issue queue focused on supported versions, we’re closing older D7 issues.
If you still have questions about using Feeds on Drupal 7, feel free to ask. While we won’t fix D7 bugs anymore, we’re happy to offer guidance to help you move forward. You can do so by opening (or reopening) a D7 issue, or by reaching out in the #feeds channel on Drupal Slack.
If this issue is still relevant for Drupal 10+, please open a follow-up issue or merge request with proposed changes. Contributions are always welcome!