Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

supports media:content #19

Closed
katat opened this issue Nov 13, 2013 · 11 comments
Closed

supports media:content #19

katat opened this issue Nov 13, 2013 · 11 comments

Comments

@katat
Copy link

katat commented Nov 13, 2013

Is there already a way to use output media:content instead of the enclosure tags for the images?

Thanks

@halfdan
Copy link

halfdan commented Mar 4, 2014

@dylang Is there any update on this? I would like to add itunes:summary and other podcast related tags to the rss feed. (http://www.apple.com/itunes/podcasts/specs.html#metadata).

@dylang
Copy link
Owner

dylang commented Sep 26, 2014

Sorry it has taken so long to get feedback on your request. I think this is a great idea.

@rv-kip
Copy link

rv-kip commented Dec 4, 2014

Perhaps a configurable whitelist of namespaces to be passed through on XML generation?

@maxnowack
Copy link
Contributor

I think it can be done with #35

@rv-kip
Copy link

rv-kip commented Dec 4, 2014

That PR works well for adding custom namespaces, but how could I implement the output of custom media elements like this (as found in a Wordpress RSS feed)?

<media:content url="http:/example.com/image.jpg" medium="image" height="449" width="798">
  <media:thumbnail url="http:/example.com/thumb_image.jpg" height="60" width="60"/>
</media:content>

@rv-kip
Copy link

rv-kip commented Dec 5, 2014

FYI This is my code for adding media:content using this PR:

    var newfeed = new RSS(options);

    var itemOptions = {
        title           : item.title,
        description     : item.description,
        url             : item.link,
        guid            : item.link,
        author          : item.author,
        pubdate         : item.pubdate,
        custom_elements : [
            {"wfw:comments": item["wfw:commentrss"]["#"]}
        ]
    };
    // add in media info if present
    if (item["media:content"]["@"]) {
        var media = item["media:content"]["@"];
        var image_custom_element = {
            "media:content": {
                _attr: {
                    medium      : media.medium,
                    href        : media.url,
                    height      : media.height,
                    width       : media.width
                }
            }
        };
        itemOptions.custom_elements.push(image_custom_element);
    }
    newfeed.item(itemOptions);

@maxnowack
Copy link
Contributor

I think, this is the piece of code you're looking for:

var image_custom_element = {
    "media:content": [{
        _attr: {
            medium: media.medium,
            href: media.url,
            height: media.height,
            width: media.width
        }
    }, {
        "media:thumbnail": {
            _attr: {
                medium: media.thumb.medium,
                href: media.thumb.url,
                height: media.thumb.height,
                width: media.thumb.width
            }
        }
    }]
}

outputs

<media:content medium="media.medium" href="media.url" height="media.height" width="media.width">
    <media:thumbnail medium="media.thumb.medium" href="media.thumb.url" height="media.thumb.height" width="media.thumb.width" />
</media:content>

@rv-kip
Copy link

rv-kip commented Dec 6, 2014

That is working for me. Thanks much! Love to see #35 merged.

@ErisDS
Copy link
Collaborator

ErisDS commented Nov 1, 2015

Closing this as it is working using the code sample provided as of #35 (version 1.1.0)

@ErisDS ErisDS closed this as completed Nov 1, 2015
@ErisDS ErisDS removed the PR Wanted label Nov 1, 2015
@ralyodio
Copy link

ralyodio commented Mar 29, 2020

I get this errror in chrome

error on line 25 at column 97: Namespace prefix media on content is not defined

somehow I need to add: xmlns:media="http://search.yahoo.com/mrss/"> to the doc

@Morantron
Copy link

Morantron commented May 12, 2020

@chovy i ran into this issue, you need to use custom_namespaces option like this


custom_namespaces: {
  media: "http://search.yahoo.com/mrss/",
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants