Skip to content

Instantly share code, notes, and snippets.

@erkattak
Forked from svperfecta/gist:141e7c1ae1e610c9cdcd
Last active September 29, 2024 12:45
Show Gist options
  • Save erkattak/071ab8af1fc64013d955 to your computer and use it in GitHub Desktop.
Save erkattak/071ab8af1fc64013d955 to your computer and use it in GitHub Desktop.
Example Event RSS Feed

Feed will support xcal (xml representation of ical). This allows us to handle event schedules (PBR) in a nice way

Feed will also support the media rss spec as part of our RSS parsing. This allows a nice way to provide links to assets (images, video, etc) within the rss feed in a standardized way.

Both of these require the tag to add additional XML namespaces (xmlns:media, xmlns:xcal).

These are used within an RSS feed like so:

<?xml version="1.0"?>
<rss version="2.0"
    xmlns:xcal="urn:ietf:params:xml:ns:xcal"
    xmlns:media="http://search.yahoo.com/mrss/"
>
    <channel>
        <title>Live Stream - Schedule</title>
        <link>http://pbr.com/en/bfts/schedule.aspx</link>
        <description>Professional Bull Riders - BFTS</description>
        <language>en-us</language>
        <lastBuildDate>Fri, 06 Jul 2015 09:39:21 EDT</lastBuildDate>
        <docs>http://www.rssboard.org/rss-2-0-9</docs>
        <generator>pbr.com</generator>
        <item>
            <title>Monster Energy Buck Off at the Garden</title>
            <link>http://cms.pbr.com/en/bfts/schedule/2016/2016-new-york.aspx</link>
            <guid>http://cms.pbr.com/en/bfts/schedule/2016/2016-new-york.aspx</guid>
            <source>http://cms.pbr.com/handlers/oddevents.aspx?series=bfts</source>
            <category>bfts</category>
            <description>Madison Square Garden</description>
            <media:content
              url = "http://server/image1.jpg"
              type = "image/jpeg"
              medium = "image">
            </media:content>
            <xcal:dtstart>2015-01-09T18:50:00Z-0600</xcal:dtstart>
            <xcal:dtend>2015-01-10T13:50:00Z-0600</xcal:dtend>
            <xcal:location>New York, NY</xcal:location>
        </item>
    </channel>
</rss>

An exampe calendar item:

<item>
            <title>Monster Energy Buck Off at the Garden</title>
            <link>http://cms.pbr.com/en/bfts/schedule/2016/2016-new-york.aspx</link>
            <guid>http://cms.pbr.com/en/bfts/schedule/2016/2016-new-york.aspx</guid>
            <source>http://cms.pbr.com/handlers/Mobile/oddEvents.ashx?series=bfts</source>
            <category>bfts</category>
            <description>Madison Square Garden</description>
            <media:content
              url = "http://server/image1.jpg"
              type = "image/jpeg"
              medium = "image">
            </media:content>
            <xcal:dtstart>2015-01-09T18:50:00Z-0600</xcal:dtstart>
            <xcal:dtend>2015-01-10T13:50:00Z-0600</xcal:dtend>
            <xcal:location>New York, NY</xcal:location>
</item>

Formatting

Image should be 16x9, and will be cooreced into 16x9 if not correct

All dates must be ISO 8601 formatted.

  • essentially, {4 digit year}-{2 digit month}-{2 digit day}T{2 digit hour in 24 hour format}-{2 digit minute}-{2 digit second}Z-{4 digit UTC offset}

C# example:

DateTime utcTime = DateTime.UtcNow;
string strUtcTime = utcTime.ToString("yyyy-MM-ddTHH:mm:ssK");
// output strUtcTime: 2012-09-17T22:02:51Z

xcal:location should be City, State

description should be the venue, or 1 line description of the event

Notes:

Here is the xCal spec

Here an example of using xcal

@AboutRSS
Copy link

Hi. Is there any instance of app or service that is able to support or integrate such kind of event RSS feed ? Cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment