Last active
December 23, 2015 01:39
-
-
Save stesie/6561677 to your computer and use it in GitHub Desktop.
german-bash.org to RSS converter written in sed
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sed -nf | |
# | |
# Generate RSS-Feed from http://www.german-bash.org/action/latest | |
# | |
# Copyright (C) 2008,2011 by Stefan Siegl <[email protected]> | |
# License: GPLv3+ | |
# | |
# Use it like this: | |
# wget -U "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100618 Iceweasel/3.5.9 (like Firefox/3.5.9)" \ | |
# -q -O- "http://www.german-bash.org/action/latest" | gbo-to-rss | |
# | |
/<html/ { c\ | |
<?xml version="1.0" encoding="utf-8"?>\ | |
<rss version="2.0">\ | |
<channel>\ | |
<title>GBO Quotes</title>\ | |
<description>german-bash.org - Die neuesten Zitate</description>\ | |
<language>de-de</language> | |
p | |
} | |
/<span class="id"><a title="Zeige Zitat/ { s|^[^0-9]*\([0-9]\+\).*|<item>\ | |
<title>GBO Quote \1</title>\ | |
<link>http://www.german-bash.org/\1</link>\ | |
<description><![CDATA[\ | |
<p>|; p | |
} | |
/<div class="zitat">$/ { :quoteloop | |
n | |
/<span class="quote_zeile">/ { | |
/<\/span>/!n | |
s|<[^>]*>||g; s|^[ \t]*||; s|$| <br />|; p; bquoteloop | |
} | |
c </p>\ | |
]]></description></item> | |
} | |
/<\/html/ { c </channel></rss> | |
p | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment