Last active
January 10, 2019 10:49
-
-
Save bennet0496/0bf1d91a6bebff0c116a to your computer and use it in GitHub Desktop.
ucigrep
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/bash | |
TMPFILE="`mktemp /tmp/ucigrep.XXXX`" | |
MATCHLINES="`mktemp /tmp/ucigrep.lines.XXXX`" | |
case $2 in | |
vorverkauf|Vorverkauf) | |
curl 'https://www.uci-kinowelt.de/coming-soon' 2> /dev/null | grep -Po "(?<=href\=\")/film.*?(?=#scroll-programm#scroll-programm\")" > $TMPFILE | |
;; | |
Programm|programm) | |
echo TODO! | |
exit -1 | |
;; | |
esac | |
grep -i "${1// /-}" $TMPFILE > $MATCHLINES | |
while read line | |
do | |
# NAME="`echo $line | html2text | tr '_' ' '`" | |
NAME="$(curl -sSL "https://www.uci-kinowelt.de$line" | grep -Po '(?<=\<title\>).*?(?=\</title\>)' | sed "s/UCI KINOWELT//g" | head -n 1)" | |
URL="http://www.uci-kinowelt.de$line" | |
cat <<EOF | |
$NAME | |
$URL | |
EOF | |
done < $MATCHLINES | |
rm $TMPFILE $MATCHLINES |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment