tadwohlrapp / soldby

SoldBy – Reveal Sellers on Amazon: See their name, country of origin and rating when browsing Amazon.
MIT License
53 stars 5 forks source link

Seller rating text on amazon.de's seller pages seems to be A/B tested currently (?) so the regex to extract the rating doesn't always work #23

Open tadwohlrapp opened 1 year ago

tadwohlrapp commented 1 year ago

Problem description

Example of familiar rating text:

image

https://www.amazon.de/sp?seller=A2N0PAQ62QEUZ

New text discovered today:

image

https://www.amazon.de/sp?seller=A3VZ5OB3NSI4Z8

Current regex to extract positive rating percentage and number of ratings on amazon.de:

/(\d+ %).*?\((\d+)/

For the above example the regex captures 95 % positive Bewertungen in den letzten 12 Monaten (154 with the two groups 95 % and 154.

Seems like it should be extended to also capture text like 100% positiv Lebensdauer (4 Gesamtbewertungen) (which by the way reads very weird in German...)

Amazon Link

https://www.amazon.de/sp?seller=A3VZ5OB3NSI4Z8

SoldBy Version

1.7.1

Browser

Brave

Userscript manager

Violentmonkey

tadwohlrapp commented 1 year ago

Updating the regex itself is not the real issue (/(\d+ ?%).*?\((\d+)/ would work just fine), but currently the percentage gets stored as a string containing the percentage sign itself.

Simply adding a ? to the space between the number and the percentage sign to make it optional would result in a mix of stored 90 % and 90% scores.

Rather the % should be omitted completely from storage and only added when rendering the scores.

We will need a solution which doesn't break already stored values.