This repository has been archived by the owner on May 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
getInfo.sh
executable file
·120 lines (100 loc) · 4.9 KB
/
getInfo.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#!/bin/bash
curl -L --output data/courseList.gz 'https://registrar.nu.edu.kz/my-registrar/public-course-catalog/json' --resolve "registrar.nu.edu.kz:443:178.91.253.115" \
-X 'POST' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Accept: application/json, text/javascript, */*; q=0.01' \
-H 'Accept-Language: en-us' \
-H 'Accept-Encoding: gzip, deflate, br' \
-H 'Host: registrar.nu.edu.kz' \
-H 'Origin: https://registrar.nu.edu.kz' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.2 Safari/605.1.15' \
-H 'Connection: keep-alive' \
-H 'Referer: https://registrar.nu.edu.kz/course-catalog' \
-H 'X-Requested-With: XMLHttpRequest' \
--data 'method=getSearchData&searchParams%5BformSimple%5D=false&searchParams%5Blimit%5D=1000&searchParams%5Bpage%5D=1&searchParams%5Bstart%5D=0&searchParams%5BquickSearch%5D=&searchParams%5BsortField%5D=-1&searchParams%5BsortDescending%5D=-1&searchParams%5Bsemester%5D=582&searchParams%5Bschools%5D=&searchParams%5Bdepartments%5D=&searchParams%5Blevels%5D=&searchParams%5Bsubjects%5D=&searchParams%5Binstructors%5D=&searchParams%5Bbreadths%5D=&searchParams%5BabbrNum%5D=&searchParams%5Bcredit%5D='
if [ $? -eq 7 ]; then
exit
fi
gunzip -c data/courseList.gz > data/courseList.json
rm data/courseList.gz
curl -L --output data/instructors.gz 'https://registrar.nu.edu.kz/my-registrar/public-course-catalog/json' --resolve "registrar.nu.edu.kz:443:178.91.253.115" \
-X 'POST' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Accept: application/json, text/javascript, */*; q=0.01' \
-H 'Accept-Language: en-us' \
-H 'Accept-Encoding: gzip, deflate, br' \
-H 'Host: registrar.nu.edu.kz' \
-H 'Origin: https://registrar.nu.edu.kz' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.2 Safari/605.1.15' \
-H 'Connection: keep-alive' \
-H 'Referer: https://registrar.nu.edu.kz/course-catalog/json' \
-H 'Content-Length: 21' \
-H 'X-Requested-With: XMLHttpRequest' \
--data 'method=getInstructors'
gunzip -c data/instructors.gz > data/instructors.json
rm data/instructors.gz
curl -L --output data/semesters.gz 'https://registrar.nu.edu.kz/my-registrar/public-course-catalog/json' --resolve "registrar.nu.edu.kz:443:178.91.253.115" \
-X 'POST' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Accept: application/json, text/javascript, */*; q=0.01' \
-H 'Accept-Language: en-us' \
-H 'Accept-Encoding: gzip, deflate, br' \
-H 'Host: registrar.nu.edu.kz' \
-H 'Origin: https://registrar.nu.edu.kz' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.2 Safari/605.1.15' \
-H 'Connection: keep-alive' \
-H 'Referer: https://registrar.nu.edu.kz/course-catalog/json' \
-H 'Content-Length: 19' \
-H 'X-Requested-With: XMLHttpRequest' \
--data 'method=getSemesters'
gunzip -c data/semesters.gz > data/semesters.json
rm data/semesters.gz
curl -L --output data/schools.gz 'https://registrar.nu.edu.kz/my-registrar/public-course-catalog/json' --resolve "registrar.nu.edu.kz:443:178.91.253.115" \
-X 'POST' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Accept: application/json, text/javascript, */*; q=0.01' \
-H 'Accept-Language: en-us' \
-H 'Accept-Encoding: gzip, deflate, br' \
-H 'Host: registrar.nu.edu.kz' \
-H 'Origin: https://registrar.nu.edu.kz' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.2 Safari/605.1.15' \
-H 'Connection: keep-alive' \
-H 'Referer: https://registrar.nu.edu.kz/course-catalog/json' \
-H 'Content-Length: 17' \
-H 'X-Requested-With: XMLHttpRequest' \
--data 'method=getSchools'
gunzip -c data/schools.gz > data/schools.json
rm data/schools.gz
curl -L --output data/departments.gz 'https://registrar.nu.edu.kz/my-registrar/public-course-catalog/json' --resolve "registrar.nu.edu.kz:443:178.91.253.115" \
-X 'POST' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-H 'Accept: application/json, text/javascript, */*; q=0.01' \
-H 'Accept-Language: en-us' \
-H 'Accept-Encoding: gzip, deflate, br' \
-H 'Host: registrar.nu.edu.kz' \
-H 'Origin: https://registrar.nu.edu.kz' \
-H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1.2 Safari/605.1.15' \
-H 'Connection: keep-alive' \
-H 'Referer: https://registrar.nu.edu.kz/course-catalog/json' \
-H 'Content-Length: 21' \
-H 'X-Requested-With: XMLHttpRequest' \
--data 'method=getDepartments'
gunzip -c data/departments.gz > data/departments.json
rm data/departments.gz
# if the last commit contains course list updates,
# we can squash new updates to it
gd=$(git diff --name-only)
if [[ ${#gd} -eq 0 ]]
then
exit
fi
echo $gd
read -p "Update course list (Y/N)? " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
git add .
git commit -m "u"
git rebase -i HEAD~2
git push --force origin master
fi