Conversation
The unzip subprocess exits non-zero with a warning on Studenac's archives, and the error path then does print(result.stderr.decode()). Studenac's stderr contains a non-UTF-8 byte (0xee), so that decode raises UnicodeDecodeError, the crawl chain swallows it, and Studenac silently yields zero products. Use zipfile instead: no subprocess, no stderr decoding, and CP437-encoded member names (written by some ZIP writers) are decoded explicitly.
Owner
Boso publishes "Najniža cijena u poslj. 30 dana", but the abbreviated column name was never mapped, so 10,295 promo rows a day arrived with no Omnibus reference and could never surface as an akcija. 1,223 of them are provable discounts (KOBAS GAVRI ČAJNA MAXI: 15.50 against a 30-day low of 18.43). fix_product_data also substituted unit_price when a retailer published no shelf price, which writes a per-kg figure into a per-package field: ARIEL 0,85 l was stored at 8223.53 instead of 12.66, across 291 trgocentar rows a day with ratios up to 650x. A row with no published price now yields no product rather than a wrong one. unit_price is no longer back-filled from price either, so null means "the chain did not publish a per-unit price" and the value can be trusted for per-gram maths. branka and zabac aliased MPC into it, which would have stored shelf prices as per-unit prices; both aliases are dropped, and since their price fields already map MPC directly, parsing is unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The unzip subprocess exits non-zero with a warning on Studenac's archives, and the error path then does print(result.stderr.decode()). Studenac's stderr contains a non-UTF-8 byte (0xee), so that decode raises UnicodeDecodeError, the crawl chain swallows it, and Studenac silently yields zero products.
Use zipfile instead: no subprocess, no stderr decoding, and CP437-encoded member names (written by some ZIP writers) are decoded explicitly.