summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2012-07-06 17:25:49 +0000
committerTrygve Laugstøl <trygvis@inamo.no>2012-07-06 17:25:49 +0000
commitc208c0abc01ed5c46774f0cabdc52f4a5b9d8a4b (patch)
treef646ab74bc781585cf1ee563bec1c4452b30f7be
downloadtv.nrk.no-to-atom-c208c0abc01ed5c46774f0cabdc52f4a5b9d8a4b.tar.gz
tv.nrk.no-to-atom-c208c0abc01ed5c46774f0cabdc52f4a5b9d8a4b.tar.bz2
tv.nrk.no-to-atom-c208c0abc01ed5c46774f0cabdc52f4a5b9d8a4b.tar.xz
tv.nrk.no-to-atom-c208c0abc01ed5c46774f0cabdc52f4a5b9d8a4b.zip
o Initial import.
-rw-r--r--.gitignore1
-rw-r--r--README.txt6
-rw-r--r--tv.nrk.no.xsl35
l---------tv.nrk.no.xsl.txt1
-rw-r--r--update-feed.sh3
l---------update-feed.sh.txt1
6 files changed, 47 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..f45b400
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+*.atom
diff --git a/README.txt b/README.txt
new file mode 100644
index 0000000..cd95ae5
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,6 @@
+Want to know what's recently been published at http://tv.nrk.no, but
+don't want to poll it all the time? Then this is the thing for you!
+
+This is a small experiment to create an atom feed from
+http://tv.nrk.no. Put the .atom file in your feed reader and you'll
+get a feed with the recent shows from NRK.
diff --git a/tv.nrk.no.xsl b/tv.nrk.no.xsl
new file mode 100644
index 0000000..18d59a9
--- /dev/null
+++ b/tv.nrk.no.xsl
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns="http://www.w3.org/2005/Atom">
+<xsl:output indent="yes"/>
+<xsl:template match="/html">
+<feed>
+ <title>New shows</title>
+ <id>urn:trygvis:tv.nrk.no,recent</id>
+ <!--
+ <updated>2003-12-13T18:30:02Z</updated>
+ -->
+ <xsl:for-each select="//li">
+<xsl:call-template name="li"/>
+ </xsl:for-each>
+</feed>
+</xsl:template>
+<xsl:template name="li">
+ <entry>
+ <id><xsl:value-of select="a/@href"/></id>
+ <!--
+ <id>urn:trygvis:tv.nrk.no,item,<xsl:value-of select='normalize-space(a)'/></id>
+ -->
+ <title><xsl:value-of select='normalize-space(a)'/></title>
+ <updated><xsl:value-of select="a/strong/time/@datetime"/></updated>
+ <author><name>Trygve Laugstøl</name></author>
+ <link>
+ <xsl:attribute name="href"><xsl:value-of select="a/@href"/></xsl:attribute>
+ </link>
+ <summary>
+ <xsl:value-of select="normalize-space(div[@class='stack-links'])"/>
+ </summary>
+ </entry>
+</xsl:template>
+</xsl:stylesheet>
diff --git a/tv.nrk.no.xsl.txt b/tv.nrk.no.xsl.txt
new file mode 120000
index 0000000..c14950c
--- /dev/null
+++ b/tv.nrk.no.xsl.txt
@@ -0,0 +1 @@
+tv.nrk.no.xsl \ No newline at end of file
diff --git a/update-feed.sh b/update-feed.sh
new file mode 100644
index 0000000..f0a7508
--- /dev/null
+++ b/update-feed.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+
+curl -s http://tv.nrk.no/listobjects/recentlysent | dos2unix |xmllint --html --dropdtd --xmlout - 2> /dev/null | xmlstarlet tr ./tv.nrk.no.xsl > tv.nrk.no.atom
diff --git a/update-feed.sh.txt b/update-feed.sh.txt
new file mode 120000
index 0000000..c0c7c0c
--- /dev/null
+++ b/update-feed.sh.txt
@@ -0,0 +1 @@
+update-feed.sh \ No newline at end of file