inventory-hunter: help euro € price problem amazon letters: & n b s p ;

I read about change Dockerfile but with euro there is a problem on amazon France Italy Germany and all the country with euro€value: The price contain strange characters 19,99 € example: <span id="price_inside_buybox" class="a-size-medium a-color-price"> 19,99&nbsp;€ </span>

And the program tells me that it’s not able to convert in float the string of the price.

I edited en_US.UTF-8 to it_IT.UTF-8 or fr or gr but it didn’t work.

Someone managed to make it work with € ? Thanks

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 21

Most upvoted comments

If you are not in a hurry to grab yourself some GPUs (believe me, I wish I could have bought a 3080 FE when I had a chance), I suggest you to wait until @EricJMarti implements the internationalization framework. But if you want I can fork the repo and “maintain” an ad-hoc solution.

It’s not that simple. The locale must be changed to it_IT.UTF-8, yes, but you need to change some code too. I’m no Python expert, but I currently have a Docker container scaping Amazon for 2080 that are currently on stock and I’m receiving the notifications on my Discord server.

You have to remove the &nbsp; HTML entity using html.unescape() (I’ve added it to the price_str in common.py file). Then you have to change strings corresponding to “add to cart” to “aggiungi al carrello” in some parts of the code.

After that, re-build the container and create your config. I’ve tested it on Amazon.it only, I’ll try and test it on other domains tomorrow if I have some spare time, but it should work for every Euro country. But you have to translate every string in every language you want to scrape.

It should. Later I will try and check for fr, es and de. I will check for co.uk too.

Because you are running the wrong Docker image.

If you do docker pull ericjmarti/inventory-hunter:latest and ./docker_run.bash -c ./config/amazon_rtx_3080.yaml -a discord -w https://discord.com/api/webhooks/*******

you are still using the original Docker image, without the ad-hoc edits we made.

So:

  • Do the edits;
  • Run docker build -t {imagename} . (where {imagename} can be something like metus88/inventory-hunter:latest. Be sure to type the period after the image name);
  • Edit the docker_run.bash at line 20, replace ericjmarti/inventory-hunter:latest with the image name you chose at the previous point;
  • Run ./docker_run.bash -c ./config/amazon_rtx_3080.yaml -a discord -w https://discord.com/api/webhooks/*******

The reason you still having issues and it seems that it doesn’t “save” your edits it’s because Docker will use the original Docker image (the one without our edits), but we want it to use our image.

Hope this clarifies the situation.

It’s not that simple. The locale must be changed to it_IT.UTF-8, yes, but you need to change some code too. I’m no Python expert, but I currently have a Docker container scaping Amazon for 2080 that are currently on stock and I’m receiving the notifications on my Discord server.

You have to remove the &nbsp; HTML entity using html.unescape() (I’ve added it to the price_str in common.py file). Then you have to change strings corresponding to “add to cart” to “aggiungi al carrello” in some parts of the code.

After that, re-build the container and create your config. I’ve tested it on Amazon.it only, I’ll try and test it on other domains tomorrow if I have some spare time, but it should work for every Euro country. But you have to translate every string in every language you want to scrape.

Thanks a lot! Could you share (or copy) your common.py file?