File tree Expand file tree Collapse file tree 2 files changed +11
-20
lines changed
Expand file tree Collapse file tree 2 files changed +11
-20
lines changed Original file line number Diff line number Diff line change @@ -106,11 +106,7 @@ export class HanayamaHuzzlesRecipe implements Recipe {
106106
107107 const level = sourceLevel ?? 'N/A' ;
108108 const index = titleGroups != null ? titleGroups . index : 'N/A' ;
109- const name = titleGroups ?. name ;
110-
111- if ( name == null ) {
112- return null ;
113- }
109+ const name = titleGroups ?. name ?? title ;
114110
115111 const images = product . querySelectorAll ( '.product-thumb > a > img' ) ;
116112 const imageLinks = Array . from ( images , image => ( image as HTMLImageElement ) . src ) ;
Original file line number Diff line number Diff line change @@ -19,6 +19,10 @@ export class IQPuzzlesRecipe implements Recipe {
1919 trackablesUpdater : TrackablesUpdater
2020 ) {
2121 const nameRegex = new RegExp ( / • (?< name > [ \w \s ] + ?) \s * $ / ) ; // https://regex101.com/r/AuK9pb/4
22+ const invalidPuzzleNames = [
23+ '№1 Haosul Îndărătnic Set 7in1' ,
24+ '№2 Haosul Îndărătnic Set 7in1'
25+ ] ;
2226 const cleanedLinkRegex = new RegExp ( / ^ (?< cleanedLink > .+ ?\. j p g ) / ) ; // https://regex101.com/r/fd3A6U/1
2327
2428 this . recipe = new NameAndImageRecipe < IQPuzzle > (
@@ -45,23 +49,14 @@ export class IQPuzzlesRecipe implements Recipe {
4549 return null ;
4650 }
4751
48- let name : string ;
49-
50- const exceptionTitle = 'Elephant' ;
51- if ( title === exceptionTitle ) {
52- name = exceptionTitle ;
53- } else {
54- const titleMatch = title . match ( nameRegex ) ;
55- const titleGroups = titleMatch ?. groups ;
56-
57- const tempName = titleGroups ?. name ;
52+ if ( invalidPuzzleNames . includes ( title ) ) {
53+ return null ;
54+ }
5855
59- if ( tempName == null ) {
60- return null ;
61- }
56+ const titleMatch = title . match ( nameRegex ) ;
57+ const titleGroups = titleMatch ?. groups ;
6258
63- name = tempName ;
64- }
59+ const name = titleGroups ?. name ?? title ;
6560
6661 const image = product . querySelector ( 'a wow-image img' ) ;
6762 const imageLink = image != null ? ( image as HTMLImageElement ) . src : '' ;
You can’t perform that action at this time.
0 commit comments