Эх сурвалжийг харах

'housofusenet.sh' hinzufügen

Daniel Wenzel 3 жил өмнө
parent
commit
9cc79977c7
1 өөрчлөгдсөн 71 нэмэгдсэн , 0 устгасан
  1. 71 0
      housofusenet.sh

+ 71 - 0
housofusenet.sh

@@ -0,0 +1,71 @@
+#!/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
+  rm -f ${PFAD}/searchresults.txt
+
+  FILMHTML=$(echo $FILM | sed -f ${PFAD}/url_escape.sed)
+  SEARCHURL=${SEARCHPREFIX}${FILMHTML}${SEARCHPOSTFIX}
+  echo $FILMHTML
+  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' > "${PFAD}/results/${FILM}.html"
+  echo "##############################" >> "${PFAD}/results/${FILM}.html"
+  echo "Filmtitel auf Festplatte: ${FILM}" >> "${PFAD}/results/${FILM}.html"
+  echo "##############################"
+  rm -f ${PFAD}/searchresults.txt
+  sleep 60
+done
+
+beenden 0