Skip to content

Conversation

louispires
Copy link

  • Reworked the _deduplicate_prices to also be able to process prices with Thousand separator
  • Adjusted watch-overview.html to show Currency in front of the Price
  • Added extract_price_from_html method which will search for the Price via the HTML content

Process price with thousand separators (comma)
@louispires
Copy link
Author

I only just saw #3342 - Which could be combined with my PR

{{ watch['restock']['price']|format_number_locale }} {{ watch['restock']['currency'] }}
</span>
<span class="restock-label price" title="Price">
{{ watch['restock']['currency'] }} {{ watch['restock']['price']|format_number_locale }}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in general the locale should dictate if the currency goes before or after, is that what this does?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, not. This isn't a big deal at all, I just had many scenarios where it would show:

In Stock 499.00 $
In Stock 2000.00 R
In Stock 3000.00 ZAR

It just looked cleaner to have it as follows:
In Stock $ 499.00
In Stock R 2000.00
In Stock ZAR 3000.00

return list(unique_data)


def extract_price_from_html(html_content):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is a really problematic approach :( many websites mention discount, shipping, specials etcetc

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally understand, however since this will only run if the first 2 options failed - Thus it might give wrong information in certain scenarios, but in these scenarios, it wouldn't have provided any information anyway.

I have 3 sites that wouldn't work with any of the current methods but now are fully functional with this additional approach - Also sites that worked before, are NOT affected by this change at all.

Copy link
Owner

@dgtlmoon dgtlmoon Sep 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a firm believer that "no information" is better than wrong information, because generally speaking it will be me who will have to deal with the new issues in the queue, it's a pattern that if I accept such a PR, there's no guarantee from the person who wrote it that they will support this code in the future on this project :)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally understand.

@dgtlmoon
Copy link
Owner

dgtlmoon commented Sep 8, 2025

basic linting didnt pass, looks like the python source code format is broke

E902 stream did not contain valid UTF-8
--> changedetectionio/processors/restock_diff/processor.py:1:1

Found 1 error.

@louispires
Copy link
Author

basic linting didnt pass, looks like the python source code format is broke

E902 stream did not contain valid UTF-8
--> changedetectionio/processors/restock_diff/processor.py:1:1

Found 1 error.

Fixed in the latest commit

@dgtlmoon
Copy link
Owner

I would actually be in favour of adding some 'pluggy' support to the price detector, then in docker-compose.yml have the ability to specify more plugins

@dgtlmoon dgtlmoon closed this Sep 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants