Skip to content

Commit 951fefd

Browse files
committed
Fixed special Hanayama Huzzles not being presented
Made the lists opt out, instead of opt in, for easier discovery of new items, without manually cross-checking with the source websites. (partially reverted from commit 44509c7)
1 parent 49ad2b9 commit 951fefd

File tree

2 files changed

+11
-20
lines changed

2 files changed

+11
-20
lines changed

src/recipes/hanayama_huzzles/HanayamaHuzzlesRecipe.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff 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);

src/recipes/iq_puzzles/IQPuzzlesRecipe.ts

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff 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>.+?\.jpg)/); // 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 : '';

0 commit comments

Comments
 (0)