#!/bin/sh echo 'Content-Type: application/rss+xml' echo '' echo '' echo '' echo ' ' echo ' ' echo ' Horriblesubs' echo ' http://horriblesubs.info/' echo ' Horriblesubs' base="http://horriblesubs.info" url=$base"/lib/latest.php" cookies=/tmp/hs.cookies download=`mktemp` curl -L -b $cookies -c $cookies -s "$url" \ -H 'Accept-Encoding: gzip, deflate, sdch' \ -H 'Accept-Language: en-US,en;q=0.8,fr;q=0.6' \ -H 'Upgrade-Insecure-Requests: 1' \ -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.103 Safari/537.36' \ -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' \ -H 'Connection: keep-alive' --compressed > $download while grep -q 'DDoS protection by CloudFlare' $download ; do script=`mktemp` grep -A1 setTimeout $download | tail -1 > $script echo 't = "'$base'/";' >> $script echo 'r = t.match(/https?:\/\//)[0];' >> $script echo 't = t.substr(r.length);' >> $script echo 't = t.substr(0,t.length-1);' >> $script grep -A8 setTimeout $download | tail -1 | tr \; \\n | sed s/.value// | while read l ; do echo "$l"\; >> $script done echo 'console.log(a);' >> $script answer=`node $script` rm $script form=`mktemp` grep form.id..challenge.form -A4 $download | tr \ \\n | grep -v ^$ > $form action=`grep action $form | cut -f2 -d\"` vc=`grep jschl_vc $form -A1 | tail -1 | cut -f2 -d\"` pass=`grep pass $form -A1 | tail -1 | cut -f2 -d\"` rm $form info="?jschl_vc=$vc&pass=$pass&jschl_answer=$answer" sleep 4 curl -L -b $cookies -c $cookies -s "$base$action$info" \ -H 'Accept-Encoding: gzip, deflate, sdch' \ -H 'Accept-Language: en-US,en;q=0.8,fr;q=0.6' \ -H 'Upgrade-Insecure-Requests: 1' \ -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.103 Safari/537.36' \ -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' \ -H 'Referer: '$url -H 'Connection: keep-alive' --compressed > $download done ( echo '' cat $download | sed 's/ id=\([^">]\+\)/ id="\1"/g' | sed 's/&/&/g' echo '' ) | ./horriblesubs-to-rss.py echo ' ' echo '' rm $download