Skip to content

Instantly share code, notes, and snippets.

@silvasur
Created July 26, 2014 21:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save silvasur/f139f29cc8ffbe6d3a96 to your computer and use it in GitHub Desktop.
Save silvasur/f139f29cc8ffbe6d3a96 to your computer and use it in GitHub Desktop.
Martina und Moritz Rezepte etwas besser druckbar aufbereiten
#!/bin/sh
# Extrahieren von [Martina und Moritz](http://martinaundmoritz.wdr.de/) Rezepten
# und aufbereiten in etwas besser druckbaren Stil.
# Klappt vielleicht auch mit anderen WDR-Rezepten.
extract_and_style() {
echo '<html>
<head>
<meta charset="utf-8"/>
<style type="text/css">
#stand, .hidden, #wfCont, #wf, .broadcastInfo, #socialBookmarks, .moreInfo, .illustrationCont, hr {
display: none;
}
h1 {
font-size: 10pt;
font-weight: normal;
}
h1 span {
display: block;
font-size: 18pt;
font-weight: bold;
}
</style>
</head>
<body>'
xmllint --xpath "//div[@id='mainColumn']" --html -
echo '</body></html>'
}
{
if test $# -eq 0; then
extract_and_style
else
curl "$1" | extract_and_style
fi
} > /tmp/martinaundmoritz.html && open /tmp/martinaundmoritz.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment