-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest-german-search.js
More file actions
44 lines (40 loc) · 1.3 KB
/
test-german-search.js
File metadata and controls
44 lines (40 loc) · 1.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
async function testGermanSearch() {
const searches = [
'Rat Colony lang:de game:paper',
'Rat Colony lang:german game:paper',
'Rattenkolonie lang:any',
'name:Rattenkolonie lang:de',
'printed_name:Rattenkolonie'
];
for (const query of searches) {
console.log('\n=== Testing query:', query, '===');
const url = new URL('https://api.scryfall.com/cards/search');
url.searchParams.set('q', query);
url.searchParams.set('unique', 'prints');
url.searchParams.set('order', 'name');
const response = await fetch(url.toString(), {
headers: {
'User-Agent': 'MTGProxyPrint/0.1',
'Accept': 'application/json'
}
});
if (response.ok) {
const data = await response.json();
console.log('Results found:', data.data?.length || 0);
if (data.data && data.data.length > 0) {
data.data.slice(0, 3).forEach(card => {
console.log('- ' + card.name + ' (' + card.set + ', ' + card.lang + ')');
if (card.printed_name) {
console.log(' Printed as: ' + card.printed_name);
}
});
}
} else {
console.log('Status:', response.status);
if (response.status === 404) {
console.log('No results found');
}
}
}
}
testGermanSearch().catch(console.error);