-
Notifications
You must be signed in to change notification settings - Fork 258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
help euro € price problem amazon letters: & n b s p ; #54
Comments
I'm having the same problem too. |
It's not that simple. The locale must be changed to You have to remove the 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? |
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. |
@Pipodi If you can share I will happy, because I'm trying to use html.unescape() but without success. (I'm noob).
For the "add to cart" problem I edited:
|
Ok, this is what I've changed. Dockerfile
src/scraper/common.py line 33-34 price_str = tag if isinstance(tag, str) else tag.text.strip()
price_str = html.unescape(price_str).strip() Don't forget to add the html import Then I changed "add to cart" string to "aggiungi al carrello". Here you can concatenate or-conditions, if you want. But yesterday, when I tried this, I didn't think of that. class GenericScrapeResult(ScrapeResult):
def parse(self):
# not perfect but usually good enough
if self.has_phrase('aggiungi al carrello') or self.has_phrase('add to basket'):
self.alert_subject = 'In Stock'
self.alert_content = self.url src/scraper/amazon.py line 24 if tag and 'aggiungi al carrello' in tag.text.lower(): Then rebuild the Docker image. I suggest you to use another tag for your Docker image, i.e. pipodi/inventory-hunter:latest, so you won't overwrite the original Docker image:
then change the image name in docker_run.bash file: line 20 default_image="{image/name:tag}" Now you can run the docker_run.bash file with your configs. I hope I've explained the changes well, if not just ask! |
Thanks for the help! I did what you wrote, but I still have this on logs: I don't care to overwrite so I did:
I edited the files:
And I ran:
After that I check the log:
but the same problem... |
Because you are running the wrong Docker image. If you do you are still using the original Docker image, without the ad-hoc edits we made. So:
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. |
You did a clear explanation! I have understood now. Thanks a lot. Now for me, it works! |
Is it normal for a product that doesn't have a price because is not in stock this message in the log?
|
Thanks for your explanation pipodi. Like Metus88, I also had problems converting the price from string to float because I am based in Singapore and the Amazon pricing looks like 'S$980'. Therefore, what I did was to:
The program could run. When I checked the log, I could see that the conversion from string to float is no longer a problem. However, I got the error message "[root] There was an issue sending to discord due to an invalid status code back -> 401". In other words, even though there was an item in stock, it could not send an alert to discord. I did not have any problem sending alerts to discord if I use the original Docker image, although the price conversion to float was there when using the original Docker image. Just putting it out there for anyone who has similar issues. Any help would be appreciated. |
Same here... I have done exactly all your modification for amazon.it and now I have the same error message |
@Pipodi I think so. Like I said earlier, when I use the original Docker image, the alert to Discord works fine. That would imply I have authorization to use the webhook, no? |
@schlep83 I tried right now with my repo fork with the edits we discussed above and I receive the alerts on my Discord channel. What did you edit? |
I close the issues becouse Discord problem is off topic for this issue. However I can confirm that the webhook for discord works great with the standard version and also with the mod version from @Pipodi . |
@Pipodi Do your changes work for amazon.co.uk? |
It should. Later I will try and check for fr, es and de. I will check for co.uk too. |
Thank you. Appreciate it! |
The second one throws an exception probably because it has no price listed, but as you can see, it works. If you want to see my edits, check out my fork: https://github.com/Pipodi/inventory-hunter as I'm waiting for the maintainer to implement the internationalization framework (I do not code in Python, I'm a Java dev, so I don't know where to start. I'm just experimenting changes learning from what it is coded). Obviously, you have to edit the ENV variables of the Dockerfile to |
For people trying to make this solution work today, DO NOT edit line 20 of docker_run.bash, edit line 21.
If these two fields share the same value, a docker pull command will be executed, which will lead to "requested access to resource denied" errors. At least, this is how I managed to make it work. |
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 € </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
toit_IT.UTF-8
or fr or gr but it didn't work.Someone managed to make it work with € ?
Thanks
The text was updated successfully, but these errors were encountered: