@@ -147,15 +147,23 @@ class HearingScraper extends EventScraper<HearingListItem, Hearing> {
147
147
return events . filter ( HearingListItem . guard )
148
148
}
149
149
150
- async getEvent ( { EventId } : HearingListItem /* e.g. 4962 */ ) {
150
+ async getEvent ( ) {
151
+ const EventId = 5091
151
152
const data = await api . getHearing ( EventId )
152
153
const content = HearingContent . check ( data )
153
154
const eventInDb = await db
154
155
. collection ( "events" )
155
156
. doc ( `hearing-${ String ( EventId ) } ` )
156
157
. get ( )
158
+
157
159
const eventData = eventInDb . data ( )
160
+ try {
161
+ Hearing . check ( eventData )
162
+ } catch ( e ) {
163
+ console . log ( e )
164
+ }
158
165
const hearing = Hearing . check ( eventData )
166
+
159
167
const shouldScrape = withinCutoff ( hearing . startsAt . toDate ( ) )
160
168
161
169
let maybeVideoURL = null
@@ -207,13 +215,26 @@ class HearingScraper extends EventScraper<HearingListItem, Hearing> {
207
215
}
208
216
}
209
217
}
218
+
210
219
const event : Hearing = {
211
220
id : `hearing-${ EventId } ` ,
212
221
type : "hearing" ,
213
222
content,
214
- videoURL : maybeVideoURL ? maybeVideoURL : undefined ,
215
- videoFetchedAt : maybeVideoURL ? Timestamp . now ( ) : undefined ,
216
- videoAssemblyId : transcript ? transcript . id : undefined ,
223
+ videoURL : hearing . videoURL
224
+ ? hearing . videoURL
225
+ : maybeVideoURL
226
+ ? maybeVideoURL
227
+ : null ,
228
+ videoFetchedAt : hearing . videoFetchedAt
229
+ ? hearing . videoFetchedAt
230
+ : maybeVideoURL
231
+ ? Timestamp . now ( )
232
+ : null ,
233
+ videoAssemblyId : hearing . videoAssemblyId
234
+ ? hearing . videoAssemblyId
235
+ : transcript
236
+ ? transcript . id
237
+ : null ,
217
238
...this . timestamps ( content )
218
239
}
219
240
return event
0 commit comments