@@ -255,7 +255,8 @@ async function fetchInfoFromSpecref(specs, options) {
255
255
256
256
async function fetchInfoFromSpecs ( specs , options ) {
257
257
const info = await Promise . all ( specs . map ( async spec => {
258
- const dom = await JSDOM . fromURL ( spec . url ) ;
258
+ const url = spec . nightly ?. url || spec . url ;
259
+ const dom = await JSDOM . fromURL ( url ) ;
259
260
260
261
if ( spec . url . startsWith ( "https://tc39.es/" ) ) {
261
262
// Title is either flagged with specific class or the second h1
@@ -264,7 +265,7 @@ async function fetchInfoFromSpecs(specs, options) {
264
265
dom . window . document . querySelectorAll ( "h1" ) [ 1 ] ;
265
266
if ( h1ecma ) {
266
267
return {
267
- nightly : { url : spec . url } ,
268
+ nightly : { url : url } ,
268
269
title : h1ecma . textContent . replace ( / \n / g, '' ) . trim ( )
269
270
} ;
270
271
}
@@ -273,7 +274,7 @@ async function fetchInfoFromSpecs(specs, options) {
273
274
const h1 = dom . window . document . querySelector ( "h1" ) ;
274
275
if ( h1 ) {
275
276
return {
276
- nightly : { url : spec . url } ,
277
+ nightly : { url : url } ,
277
278
title : h1 . textContent . replace ( / \n / g, '' ) . trim ( )
278
279
} ;
279
280
}
@@ -283,12 +284,12 @@ async function fetchInfoFromSpecs(specs, options) {
283
284
const title = dom . window . document . querySelector ( "title" ) ;
284
285
if ( title ) {
285
286
return {
286
- nightly : { url : spec . url } ,
287
+ nightly : { url : url } ,
287
288
title : title . textContent . replace ( / \n / g, '' ) . trim ( )
288
289
} ;
289
290
}
290
291
291
- throw `Could not find title in ${ spec . url } for spec "${ spec . shortname } "` ;
292
+ throw `Could not find title in ${ url } for spec "${ spec . shortname } "` ;
292
293
} ) ) ;
293
294
294
295
const results = { } ;
0 commit comments