@@ -476,14 +476,23 @@ function writeDescription(video) {
476
476
description += `\n${ group . title } :\n` ;
477
477
for ( const link of group . links ) {
478
478
link . icon = link . icon || ( group . title === 'Videos' ? '🎥' : '🔗' ) ;
479
- const url = link . url ;
480
- if ( / h t t p s ? : \/ \/ .* / . test ( url ) ) {
479
+ let url ;
480
+ if ( / h t t p s ? : \/ \/ .* / . test ( link . url ) ) {
481
481
// Starts with http:// or https://
482
- description += ` ${ link . icon } ${ link . title } : ${ url } \n` ;
482
+ url = link . url ;
483
483
} else {
484
484
// assume relative link in thecodingtrain.com
485
485
// try to get YT link instead of website link
486
- description += `${ link . icon } ${ link . title } : ${ resolveCTLink ( url ) } \n` ;
486
+ url = resolveCTLink ( link . url ) ;
487
+ }
488
+ // if it's a youtube link, don't add the title (#1280)
489
+ if (
490
+ new URL ( url ) . hostname . includes ( 'youtube' ) ||
491
+ new URL ( url ) . hostname . includes ( 'youtu.be' )
492
+ ) {
493
+ description += `${ link . icon } ${ url } \n` ;
494
+ } else {
495
+ description += `${ link . icon } ${ link . title } ${ url } \n` ;
487
496
}
488
497
}
489
498
}
@@ -499,8 +508,7 @@ function writeDescription(video) {
499
508
if ( challengeData ) {
500
509
const { videoNumber, challengeTitle } = challengeData . data ;
501
510
const url = challengeData . canonicalURL ;
502
- description +=
503
- `🚂 ${ videoNumber } ${ challengeTitle } : ${ resolveCTLink ( url ) } ` + '\n' ;
511
+ description += `🚂 CC${ videoNumber } ${ resolveCTLink ( url ) } ` + '\n' ;
504
512
} else {
505
513
console . log ( `Challenge ${ challenge } not found` ) ;
506
514
}
0 commit comments