@@ -383,11 +383,14 @@ function writeDescription(video) {
383
383
}
384
384
385
385
// Other Code Examples
386
- const otherCodeExamples = data . codeExamples ?. filter (
387
- ( ex ) => ! ex . urls . p5 && ! ex . urls . github
388
- ) ;
389
386
const getURL = ( urls ) =>
390
387
urls . p5 || urls . processing || urls . node || urls . other ;
388
+ const otherCodeExamples = data . codeExamples ?. filter (
389
+ ( ex ) =>
390
+ ! ex . urls . p5 &&
391
+ getURL ( ex . urls ) !== repoLink &&
392
+ ! sketchUrls . includes ( getURL ( ex . urls ) )
393
+ ) ;
391
394
if ( otherCodeExamples && otherCodeExamples . length > 0 ) {
392
395
if ( otherCodeExamples . length > 1 ) {
393
396
if ( sketchUrls ?. length > 0 || repoLink ) description += '\n' ;
@@ -413,7 +416,7 @@ function writeDescription(video) {
413
416
if ( otherParts . length > 0 ) {
414
417
description += '\nOther Parts of this Challenge:' ;
415
418
for ( const part of otherParts ) {
416
- description += `\nπΊ ${ part . data . partTitle } : https://youtu.be/${ part . data . videoId } ` ;
419
+ description += `\nπΊ https://youtu.be/${ part . data . videoId } ` ;
417
420
}
418
421
description += '\n' ;
419
422
}
@@ -476,14 +479,23 @@ function writeDescription(video) {
476
479
description += `\n${ group . title } :\n` ;
477
480
for ( const link of group . links ) {
478
481
link . icon = link . icon || ( group . title === 'Videos' ? 'π₯' : 'π' ) ;
479
- const url = link . url ;
480
- if ( / h t t p s ? : \/ \/ .* / . test ( url ) ) {
482
+ let url ;
483
+ if ( / h t t p s ? : \/ \/ .* / . test ( link . url ) ) {
481
484
// Starts with http:// or https://
482
- description += ` ${ link . icon } ${ link . title } : ${ url } \n` ;
485
+ url = link . url ;
483
486
} else {
484
487
// assume relative link in thecodingtrain.com
485
488
// try to get YT link instead of website link
486
- description += `${ link . icon } ${ link . title } : ${ resolveCTLink ( url ) } \n` ;
489
+ url = resolveCTLink ( link . url ) ;
490
+ }
491
+ // if it's a youtube link, don't add the title (#1280)
492
+ if (
493
+ new URL ( url ) . hostname . includes ( 'youtube' ) ||
494
+ new URL ( url ) . hostname . includes ( 'youtu.be' )
495
+ ) {
496
+ description += `${ link . icon } ${ url } \n` ;
497
+ } else {
498
+ description += `${ link . icon } ${ link . title } : ${ url } \n` ;
487
499
}
488
500
}
489
501
}
@@ -497,10 +509,8 @@ function writeDescription(video) {
497
509
vid . urls . includes ( `challenges/${ challenge } ` )
498
510
) ;
499
511
if ( challengeData ) {
500
- const { videoNumber, challengeTitle } = challengeData . data ;
501
512
const url = challengeData . canonicalURL ;
502
- description +=
503
- `π ${ videoNumber } ${ challengeTitle } : ${ resolveCTLink ( url ) } ` + '\n' ;
513
+ description += `π ${ resolveCTLink ( url ) } ` + '\n' ;
504
514
} else {
505
515
console . log ( `Challenge ${ challenge } not found` ) ;
506
516
}
@@ -550,8 +560,8 @@ Music from Epidemic Sound`;
550
560
ποΈ Twitter: https://twitter.com/thecodingtrain
551
561
πΈ Instagram: https://www.instagram.com/the.coding.train/
552
562
553
- π₯ Coding Challenges: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
554
- π₯ Intro to Programming: https://www.youtube.com/playlist?list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA
563
+ π₯ https://www.youtube.com/playlist?list=PLRqwX-V7Uu6ZiZxtDDRCi6uhfTH4FilpH
564
+ π₯ https://www.youtube.com/playlist?list=PLRqwX-V7Uu6Zy51Q-x9tMWIv9cueOFTFA
555
565
556
566
π p5.js: https://p5js.org
557
567
π p5.js Web Editor: https://editor.p5js.org/
0 commit comments