Skip to content

Commit a02c496

Browse files
committed
Add support for polskikoszyk
1 parent 61c317d commit a02c496

3 files changed

Lines changed: 18 additions & 1 deletion

File tree

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ Wspierane sklepy
3838
* https://e-prim.pl
3939
* https://lisek.app/
4040
* https://pyszneeko.pl/
41+
* https://polskikoszyk.pl/
4142

4243
Pracujemy nad wsparciem dla
4344
---------------------------
4445
* https://mamyito.pl
45-
* https://polskikoszyk.pl/
4646
* https://zakupy.biedronka.pl/
4747
* https://delio.com.pl/
4848
* https://topaz24.pl/

content_scripts/pola.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,17 @@
3838
for (let elem of flix) {
3939
result.push(elem.getAttribute('data-flix-ean'));
4040
}
41+
// Kody w danych strukturalnych schema.org (JSON-LD) — generyczny skan
42+
// ich nie widzi, bo usuwa wszystkie bloki <script>.
43+
let ldjson = document.querySelectorAll('script[type="application/ld+json"]');
44+
for (let elem of ldjson) {
45+
for (let m of elem.textContent.matchAll(/"gtin(?:13|8)?"\s*:\s*"(\d{13}|\d{8})(?=")/g)) {
46+
if (result === null) {
47+
result = [];
48+
}
49+
result.push(m[1]);
50+
}
51+
}
4152
}
4253
if (result !== null) {
4354
result = result.filter((v, i, a) => a.indexOf(v) === i);

test-e2e/ean-detection.spec.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,12 @@ const productPages = [
166166
ean: '5900012003608',
167167
url: 'https://e-prim.pl/pl/products/olej-kujawski-2l-11380',
168168
},
169+
{
170+
store: 'polskikoszyk.pl',
171+
product: 'Dega Sałatka pikantna z makrelą 130 g',
172+
ean: '5907623267788',
173+
url: 'https://polskikoszyk.pl/dega-salatka-pikantna-z-makrela-130g',
174+
},
169175
{
170176
store: 'pyszneeko.pl',
171177
product: 'Mąka pszenna tortowa typ 480 1 kg Bio Planet EKO',

0 commit comments

Comments
 (0)