| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- #!/bin/bash
- PFAD=$(dirname "$(readlink -f "$0")")
- function beenden {
- rm -f $COOKIEFILE
- rm -f landingpage.txt
- rm -f searchresults.txt
- umount /scripts/housofusenet/mount
- exit $1
- }
- USERAGENT='User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0'
- COOKIEFILE="/tmp/hou-cookie.txt"
- curl -s -H "${USERAGENT}" 'https://house-of-usenet.com/member.php?action=login' --cookie-jar ${COOKIEFILE} -o ${PFAD}/landingpage.txt
- POSTKEY=$(grep -m 1 '<input name="my_post_key"' ${PFAD}/landingpage.txt | cut -d "=" -f 4 | cut -d '"' -f2)
- #echo "Postkey: $POSTKEY"
- #cat $COOKIEFILE
- curl -s -X POST -H "${USERAGENT}" --referer 'https://house-of-usenet.com/member.php?action=login' -b ${COOKIEFILE} --cookie-jar ${COOKIEFILE} -F "username=bla1bla1" -F "password=bla2bla2" -F "action=do_login" -F "my_post_key=${POSTKEY}" -F "remember=yes" 'https://house-of-usenet.com/member.php'
- #später curl mit -b cookie benutzen, nachdem eingeloggt
- SEARCHPREFIX='https://house-of-usenet.com/search.php?action=do_search&keywords='
- SEARCHPOSTFIX='&postthread=2&author=&matchusername=1&findthreadst=1&numreplies=&postdate=0&pddir=1&threadprefix%5B%5D=any&sortby=lastpost&sortordr=desc&showresults=threads&forums%5B%5D=1865&submit=Suche'
- mount -t cifs //nhi-to-sw-serv.klenzel.net/Videos$ ${PFAD}/mount -o credentials=${PFAD}/smbcredentials,iocharset=utf8,sec=ntlmssp,vers=2.0,dir_mode=0770
- if [ $? -ne 0 ] ; then
- echo "Error while mounting"
- beenden 1
- fi
- #find ${PFAD}/mount/Filme/h.264\ -\ 1080p/ -type d -printf '%f\n' | while read FILM; do
- #find ${PFAD}/mount/Filme/h.264\ -\ 720p/ -type d -printf '%f\n' | while read FILM; do
- find ${PFAD}/mount/Filme/SD/ -type d -printf '%f\n' | while read FILM; do
- rm -f ${PFAD}/searchresults.txt
- echo "##############################"
- sleep 30
- #hier werden Wörter mit nur 3 Buchstaben entfernt sowie anschließend doppelte Leerzeichen und Leerzeichen am Anfang/Ende
- FILMKURZ=$(echo ${FILM} | sed 's/\<.\{,3\}\>//g' | sed 's/-//g' |awk '{$1=$1};1')
- if [ "$FILMKURZ" == "" ] ; then
- echo "Name zu kurz, leerer String: ${FILM}"
- continue
- fi
- FILMHTML=$(echo $FILMKURZ | sed -f ${PFAD}/url_escape.sed)
- SEARCHURL=${SEARCHPREFIX}${FILMHTML}${SEARCHPOSTFIX}
- echo "Aktueller Film: $FILM"
- echo $SEARCHURL
- curl -s -L -H "${USERAGENT}" -b ${COOKIEFILE} "${SEARCHURL}" -o ${PFAD}/searchresults.txt
- grep "keine Ergebnisse gefunden" ${PFAD}/searchresults.txt > /dev/null
- if [ $? -eq 0 ] ; then
- echo "Nichts gefunden"
- continue
- fi
- grep "kürzer als erlaubt" ${PFAD}/searchresults.txt > /dev/null
- if [ $? -eq 0 ] ; then
- echo "Suchbegriff zu kurz"
- continue
- fi
- grep "showthread.php" ${PFAD}/searchresults.txt | grep "subject_old" | sed 's@showthread.php@https://house-of-usenet.com/showthread.php@g' | sed ':a;N;$!ba;s/\n/<br>\r\n/g' > "${PFAD}/results/${FILM}.html"
- echo "<br>##############################" >> "${PFAD}/results/${FILM}.html"
- echo "<br>Filmtitel auf Festplatte: ${FILM}" >> "${PFAD}/results/${FILM}.html"
- #echo "##############################"
- rm -f ${PFAD}/searchresults.txt
- #sleep 60
- done
- beenden 0
|