Skip to content

Instantly share code, notes, and snippets.

@morxa
Created December 15, 2016 15:45
Show Gist options
  • Save morxa/265b3a432d0877e3c40a1fb7e72cda84 to your computer and use it in GitHub Desktop.
Save morxa/265b3a432d0877e3c40a1fb7e72cda84 to your computer and use it in GitHub Desktop.
minkorrekt china gadgets
#! /bin/bash
#
# chinagadgets.bash
# Created: Thu 15 Dec 2016 15:53:11 CET
# Copyright 2016 Till Hofmann <till.hofmann@posteo.de>
#
# This work is free. You can redistribute it and/or modify it under the
# terms of the Do What The Fuck You Want To Public License, Version 2,
# as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
# Short script to fetch all mentioned china gadgets from minkorrekt.de.
feedfile=$(mktemp)
curl -s http://minkorrekt.de/feed/mp3/ > $feedfile
episodes=$(grep \
"<link>http://minkorrekt.de/\(minkorrekt\|methodisch\)" $feedfile |\
sed "s:</\?link>::g")
echo """
<html>
<body>
<meta charset="utf-8" />
""" > chinagadgets.html
for episode in $episodes; do
episodenum=$(echo $episode | \
grep -o -e "folge-\([0-9]\)*" | sed "s/folge-//" )
chinagadget=$(curl -s $episode | grep -i china)
echo """
<p>
<a href="$episode">Folge ${episodenum}:</a>
<br />
$chinagadget
</p>
""" >> chinagadgets.html
done
echo """
</body>
</html>
""" >> chinagadgets.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment