File tree Expand file tree Collapse file tree 3 files changed +15
-5
lines changed Expand file tree Collapse file tree 3 files changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ if [ -z "$2" ]; then
37
37
done
38
38
39
39
URL=" https://sheeptester.github.io/uxdy/"
40
+ TAG=" uxdy"
40
41
else
41
42
# Check out existing files in gh-pages
42
43
git checkout origin/gh-pages
47
48
cp -ar ../../$1 /. $2
48
49
49
50
URL=" https://sheeptester.github.io/uxdy/$2 /"
51
+ TAG=" $2 "
50
52
fi
51
53
52
54
# Commit everything and push
53
55
git checkout -b gh-pages
54
56
git add .
55
- git commit -m " Building for $LAST_COMMIT
57
+ git commit -m " $TAG : Deploy $LAST_COMMIT
56
58
57
59
$URL "
58
60
git push origin gh-pages
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ def get(path, query = {})
26
26
end
27
27
28
28
begin
29
- return JSON . parse ( File . read ( "./webreg-data /#{ file_name } .json" ) , symbolize_names : true )
29
+ return JSON . parse ( File . read ( "./cache-wi22 /#{ file_name } .json" ) , symbolize_names : true )
30
30
rescue Errno ::ENOENT
31
31
end
32
32
@@ -35,8 +35,11 @@ def get(path, query = {})
35
35
# I don't think UqZBpD3n needs to be a secret but whatever
36
36
"Cookie" => "jlinksessionidx=#{ @session_index } ; UqZBpD3n=#{ @uqz } " ,
37
37
} ) . read , symbolize_names : true )
38
+ if json . length > 0 && json [ 0 ] [ :VERIFY ] == "FAIL"
39
+ raise "[0].VERIFY: FAIL #{ file_name } "
40
+ end
38
41
# File.write: https://stackoverflow.com/a/19337403
39
- File . write ( "./webreg-data /#{ file_name } .json" , JSON . pretty_generate ( json ) )
42
+ File . write ( "./cache-wi22 /#{ file_name } .json" , JSON . pretty_generate ( json ) )
40
43
puts "Fetched #{ file_name } "
41
44
json
42
45
end
Original file line number Diff line number Diff line change @@ -132,6 +132,11 @@ export class Scraper {
132
132
? response . json ( )
133
133
: Promise . reject ( `HTTP ${ response . status } error from ${ response . url } ` )
134
134
)
135
+ if ( json ?. [ 0 ] ?. VERIFY === 'FAIL' ) {
136
+ throw new Error (
137
+ 'WebReg returned VERIFY: FAIL. Was the quarter selected on WebReg?'
138
+ )
139
+ }
135
140
if ( this . #cachePath !== null ) {
136
141
await Deno . writeTextFile (
137
142
joinPath ( this . #cachePath, `${ fileName } .json` ) ,
@@ -678,10 +683,10 @@ export class ScheduleSection extends BaseGroup<RawGetClassResult> {
678
683
}
679
684
680
685
if ( import . meta. main ) {
681
- const getter = new Scraper ( 'WI22 ' , {
686
+ const getter = new Scraper ( 'SP22 ' , {
682
687
jlinksessionidx : Deno . args [ 1 ] ,
683
688
UqZBpD3n : Deno . args [ 0 ] ,
684
- cachePath : 'cache-wi22 '
689
+ cachePath : 'cache-sp22 '
685
690
} )
686
691
const courses = [ ]
687
692
const freq : Record < number , number > = { }
You can’t perform that action at this time.
0 commit comments