From 564b4bceb52ea8929b17f3f0601239ae971255bc Mon Sep 17 00:00:00 2001 From: Saksham Sharma Date: Sat, 12 Mar 2016 14:36:25 +0530 Subject: [PATCH] Add course scraping script. --- courses.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 courses.sh diff --git a/courses.sh b/courses.sh new file mode 100755 index 0000000..d249791 --- /dev/null +++ b/courses.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +# Author: Saksham Sharma +# 12th March, 2016 + +# Usage: +# ./courses.sh +roll=$1 + +# Send CURL request to doaa scheduler +# Keep it as close to the browser request as possible to prevent detection. +output=$(curl -s "http://172.26.142.68/examscheduler2/personal_schedule.php?rollno=$roll" -H 'Accept-Encoding: gzip, deflate, sdch' -H 'Accept-Language: en-US,en;q=0.8' -H 'Upgrade-Insecure-Requests: 1' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.8 Safari/537.36' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Referer: http://172.26.142.68/examscheduler2/personal.html' --compressed) + +# Parse the single line output with a large incomprehensible RegEx I wrote today and will forget tomorrow. +echo $output | grep -E "([^<]*)" -o | grep -E ">([^<]+)<" -o | grep -E "[^><]*" -o