summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYves Fischer <yvesf-git@xapek.org>2016-08-27 17:52:13 +0200
committerYves Fischer <yvesf-git@xapek.org>2016-08-27 17:57:29 +0200
commit8ce41c4331d3e9386119516bf482a07456c4a5ec (patch)
treedc49882ce5d464aa9f07bd230c2474561a208aa4
downloadheise-eisschrank-8ce41c4331d3e9386119516bf482a07456c4a5ec.tar.gz
heise-eisschrank-8ce41c4331d3e9386119516bf482a07456c4a5ec.zip
heise-eisschrank
-rw-r--r--README.md15
-rw-r--r--filter.xsl61
-rwxr-xr-xrun.sh4
3 files changed, 80 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..875ab59
--- /dev/null
+++ b/README.md
@@ -0,0 +1,15 @@
+# heise Eisschrank
+*Nimmt die heisse Luft aus dem heise.de Newsticker*
+
+```bash
+$ ./run.sh
+# writes atom feed in file: ./heise-atom-filtered.xml
+```
+
+### Demo
+[https://www.xapek.org/~yvesf/public/heise-eisschrank/heise-atom-filtered.xml](https://www.xapek.org/~yvesf/public/heise-eisschrank/heise-atom-filtered.xml)
+
+### Requires
+
+- wget
+- xsltproc \ No newline at end of file
diff --git a/filter.xsl b/filter.xsl
new file mode 100644
index 0000000..0ebbe4b
--- /dev/null
+++ b/filter.xsl
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="utf8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:atom="http://www.w3.org/2005/Atom"
+>
+ <xsl:template match="@*|node()">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:template>
+
+ <xsl:template match="title">
+ <atom:title>heise online News (filtered)</atom:title>
+ </xsl:template>
+
+ <xsl:template name="test">
+ <xsl:param name="title"/>
+ <xsl:param name="summary"/>
+ <xsl:if test="contains($title, 'Apple') or contains($summary, 'Apple')">
+ SKIP
+ </xsl:if>
+ <xsl:if test="contains($title, 'iPhone') or contains($summary, 'iPhone')">
+ SKIP
+ </xsl:if>
+ <xsl:if test="contains($title, 'WhatsApp')">
+ SKIP
+ </xsl:if>
+ <xsl:if test="contains($title, 'Dropbox') or contains($summary, 'Dropbox')">
+ SKIP
+ </xsl:if>
+ <xsl:if test="contains($title, 'Facebook')">
+ SKIP
+ </xsl:if>
+ <xsl:if test="contains($title, 'Uber')">
+ SKIP
+ </xsl:if>
+ <xsl:if test="contains($title, 'Windows 10')">
+ SKIP
+ </xsl:if>
+ </xsl:template>
+
+ <xsl:template match="atom:entry">
+ <xsl:variable name="testResult">
+ <xsl:call-template name="test">
+ <xsl:with-param name="title" select="atom:title/text()"/>
+ <xsl:with-param name="summary" select="atom:summary/text()"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="contains($testResult, 'SKIP')">
+ <xsl:comment>
+ Skip entry:
+ <xsl:copy-of select="."/>
+ </xsl:comment>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:copy-of select="."/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:template>
+</xsl:stylesheet> \ No newline at end of file
diff --git a/run.sh b/run.sh
new file mode 100755
index 0000000..8047409
--- /dev/null
+++ b/run.sh
@@ -0,0 +1,4 @@
+#!/bin/sh
+FEED_URL="http://www.heise.de/newsticker/heise-atom.xml"
+
+wget -O - -q "$FEED_URL" | xsltproc filter.xsl - > heise-atom-filtered.xml \ No newline at end of file