Skip to content

Commit 52cb83d

Browse files
committed
Merge from develop
1 parent 321f9f3 commit 52cb83d

File tree

4 files changed

+15
-34
lines changed

4 files changed

+15
-34
lines changed

go.mod

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ require (
1111
github.com/joho/godotenv v1.5.1
1212
github.com/valyala/fastjson v1.6.4
1313
go.mongodb.org/mongo-driver v1.17.3
14-
golang.org/x/net v0.36.0
15-
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c
14+
golang.org/x/net v0.43.0
1615
)
1716

1817
require (
@@ -58,9 +57,6 @@ require (
5857
github.com/josharian/intern v1.0.0 // indirect
5958
github.com/json-iterator/go v1.1.12 // indirect
6059
github.com/klauspost/compress v1.17.8 // indirect
61-
github.com/klauspost/cpuid/v2 v2.2.9 // indirect
62-
github.com/kr/pretty v0.3.1 // indirect
63-
github.com/kr/text v0.2.0 // indirect
6460
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
6561
github.com/leodido/go-urn v1.4.0 // indirect
6662
github.com/mailru/easyjson v0.9.0 // indirect
@@ -70,7 +66,6 @@ require (
7066
github.com/montanaflynn/stats v0.7.1 // indirect
7167
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
7268
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 // indirect
73-
github.com/rogpeppe/go-internal v1.13.1 // indirect
7469
github.com/stretchr/testify v1.11.1 // indirect
7570
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
7671
github.com/ugorji/go/codec v1.3.0 // indirect

go.sum

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ github.com/cloudwego/base64x v0.1.6 h1:t11wG9AECkCDk5fMSoxmufanudBtJ+/HemLstXDLI
5252
github.com/cloudwego/base64x v0.1.6/go.mod h1:OFcloc187FXDaYHvrNIjxSe8ncn0OOM8gEHfghB2IPU=
5353
github.com/cncf/xds/go v0.0.0-20250121191232-2f005788dc42 h1:Om6kYQYDUk5wWbT0t0q6pvyM49i9XZAv9dDrkDA7gjk=
5454
github.com/cncf/xds/go v0.0.0-20250121191232-2f005788dc42/go.mod h1:W+zGtBO5Y1IgJhy4+A9GOqVhqLpfZi+vwmdNXUehLA8=
55-
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
5655
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
5756
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
5857
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -118,17 +117,10 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr
118117
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
119118
github.com/klauspost/compress v1.17.8 h1:YcnTYrq7MikUT7k0Yb5eceMmALQPYBW/Xltxn0NAMnU=
120119
github.com/klauspost/compress v1.17.8/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
121-
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
122-
github.com/klauspost/cpuid/v2 v2.2.9 h1:66ze0taIn2H33fBvCkXuv9BmCwDfafmiIVpKV9kKGuY=
123-
github.com/klauspost/cpuid/v2 v2.2.9/go.mod h1:rqkxqrZ1EhYM9G+hXH7YdowN5R5RGN6NK4QwQ3WMXF8=
124-
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
125-
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
126120
github.com/klauspost/cpuid/v2 v2.3.0 h1:S4CRMLnYUhGeDFDqkGriYKdfoFlDnMtqTiI/sFzhA9Y=
127121
github.com/klauspost/cpuid/v2 v2.3.0/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
128122
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
129123
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
130-
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
131-
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
132124
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
133125
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
134126
github.com/ledongthuc/pdf v0.0.0-20220302134840-0c2507a12d80 h1:6Yzfa6GP0rIo/kULo2bwGEkFvCePZ3qHDDTC3/J9Swo=
@@ -148,16 +140,12 @@ github.com/montanaflynn/stats v0.7.1 h1:etflOAAHORrCC44V+aR6Ftzort912ZU+YLiSTuV8
148140
github.com/montanaflynn/stats v0.7.1/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow=
149141
github.com/orisano/pixelmatch v0.0.0-20220722002657-fb0b55479cde h1:x0TT0RDC7UhAVbbWWBzr41ElhJx5tXPWkIHA2HWPRuw=
150142
github.com/orisano/pixelmatch v0.0.0-20220722002657-fb0b55479cde/go.mod h1:nZgzbfBr3hhjoZnS66nKrHmduYNpc34ny7RK4z5/HM0=
151-
github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M=
152-
github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc=
153-
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
154143
github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4=
155144
github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
156145
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10 h1:GFCKgmp0tecUJ0sJuv4pzYCqS9+RGSn52M3FUwPs+uo=
157146
github.com/planetscale/vtprotobuf v0.6.1-0.20240319094008-0393e58bdf10/go.mod h1:t/avpk3KcrXxUnYOhZhMXJlSEyie6gQbtLq5NM3loB8=
158147
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
159148
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
160-
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
161149
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
162150
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
163151
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=

parser/calendarParser.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,12 @@ var validAbbreviations []string = []string{
132132
}
133133

134134
func ParseCalendar(inDir string, outDir string) {
135-
136-
calendarFile, err := os.ReadFile(inDir + "/eventScraped.json")
135+
136+
calendarFile, err := os.ReadFile(inDir + "/calendarScraped.json")
137137
if err != nil {
138138
panic(err)
139139
}
140-
140+
141141
var allEvents []schema.Event
142142

143143
err = json.Unmarshal(calendarFile, &allEvents)
@@ -147,7 +147,7 @@ func ParseCalendar(inDir string, outDir string) {
147147

148148
multiBuildingMap := make(map[string]map[string]map[string][]schema.Event)
149149

150-
for _, event := range(allEvents) {
150+
for _, event := range allEvents {
151151

152152
// Get date
153153
dateTime := event.StartTime
@@ -166,7 +166,7 @@ func ParseCalendar(inDir string, outDir string) {
166166

167167
// buildingRegexp might capture something that isn't a valid building abbreviation (e.g., UTD)
168168
isValidBuilding := slices.Contains(validAbbreviations, building)
169-
169+
170170
// If location doesn't have building abbreviation or buildingRegexp captured an invalid abbreviation,
171171
// check for the full building name
172172
lowercaseLocation := strings.ToLower(*location)
@@ -178,13 +178,13 @@ func ParseCalendar(inDir string, outDir string) {
178178
}
179179
}
180180
}
181-
181+
182182
// If location doesn't have room number, check to see if location included a room
183183
if room == "" && isValidBuilding {
184-
locationParts := strings.SplitN(*location, ",", 2)
184+
locationParts := strings.SplitN(*location, ", ", 2)
185185
if len(locationParts) == 2 {
186186
room = locationParts[1]
187-
}
187+
}
188188
}
189189

190190
// If building is still empty string, then location was initally an empty string
@@ -234,8 +234,8 @@ func ParseCalendar(inDir string, outDir string) {
234234
Buildings: singleBuildings,
235235
})
236236
}
237-
237+
238238
log.Print("Parsed Calendar!")
239239

240-
utils.WriteJSON(fmt.Sprintf("%s/events.json", outDir), result)
241-
}
240+
utils.WriteJSON(fmt.Sprintf("%s/calendar.json", outDir), result)
241+
}

scrapers/calendar.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,7 @@ func ScrapeCalendar(outDir string) {
5454
if err := scrapeAndUnmarshal(&cli, page+1, &calendarData); err != nil {
5555
panic(err)
5656
}
57-
log.Printf("Scraped events of page %d successfully!\n", page+1)
5857

59-
log.Printf("Parsing the events of page %d...", page+1)
6058
for _, rawEvent := range calendarData.Events {
6159
// Parse the time
6260
eventInstance := toMap(toMap(toSlice(rawEvent.Event["event_instances"])[0])["event_instance"])
@@ -131,13 +129,13 @@ func ScrapeCalendar(outDir string) {
131129
ContactPhoneNumber: contactInfo[2],
132130
})
133131
}
134-
log.Printf("Parsed the events of page %d successfully!\n\n", page+1)
132+
log.Printf("Scraped events of page %d successfully!\n", page+1)
135133
}
136134

137-
if err := utils.WriteJSON(fmt.Sprintf("%s/eventScraped.json", outDir), events); err != nil {
135+
if err := utils.WriteJSON(fmt.Sprintf("%s/calendarScraped.json", outDir), events); err != nil {
138136
panic(err)
139137
}
140-
log.Printf("Finished parsing %d events successfully!\n\n", len(events))
138+
log.Printf("Finished scraping %d events successfully!\n\n", len(events))
141139
}
142140

143141
// scrapeAndUnmarshal fetches a calendar page and decodes it into data.

0 commit comments

Comments
 (0)