dcwangmit01 / amazon-invoice-downloader

Automatically download Amazon Invoices as PDFs
MIT License
28 stars 13 forks source link

Amazon UK version? #4

Open figjamalba opened 9 months ago

figjamalba commented 9 months ago

Would it be possible to adapt this for Amazon UK. I have tried, modifying line 80 and 158 to amazon.co.uk

The next change would be 141 to read "%d %B %Y" And fix the output on line 142, to replace £ instead of $ and zapping the comma in the format.

So far so good except it failed on 160 AttributeError: 'NoneType' object has no attribute 'get_attribute'. Did you mean: '__getattribute__'? And since I am a n00b, I have no idea to fix this.

figjamalba commented 9 months ago

Here is the error output

Saving file [/home/gary/amazon-invoice-downloader/dist/amazon_invoice_downloader-0.4.0/downloads/20240220_9.99_amazon_204-9792541-9419510.pdf]
Traceback (most recent call last):
  File "/home/gary/.local/share/hatch/env/virtual/amazon-invoice-downloader/OUBFGZow/amazon-invoice-downloader/bin/amazon-invoice-downloader", line 8, in <module>
    sys.exit(amazon_invoice_downloader())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/gary/amazon-invoice-downloader/dist/amazon_invoice_downloader-0.4.0/src/amazon_invoice_downloader/cli/__init__.py", line 179, in amazon_invoice_downloader
    run(playwright, args)
  File "/home/gary/amazon-invoice-downloader/dist/amazon_invoice_downloader-0.4.0/src/amazon_invoice_downloader/cli/__init__.py", line 160, in run
    ).get_attribute("href")
      ^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'get_attribute'. Did you mean: '__getattribute__'?
jbredcar commented 8 months ago

I would love to use this for Amazon UK too please!

cypris75 commented 8 months ago

I created a simplified Jupyter Notebook based on the code of this repo.

This works for Amazon.de (Germany) and is currently hard-coded to download all invoices from the current year.

See gist here:

https://gist.github.com/cypris75/dc8baf5ea67b87d87ae839468ffdaa0c

To make it work for UK you would need to adjust the following:

You also need an .env file with your login data:

AMAZON_EMAIL=jeff@amazon.com
AMAZON_PASSWORD=itsstilldayone

Hope this helps someone.

luke-burnett commented 7 months ago

Created a UK fork to be run as a python script: https://github.com/luke-burnett/amazon-invoice-downloader/tree/main

Thanks to Cypris75 too as some of their code is used.

pboushy commented 4 months ago

@dcwangmit01 @luke-burnett - I've been investigating some bugs with this and enhancing various areas in general that I'm wanting to push upstream. I'm also up to making this work on more languages. Are y'all interested in collaborating to make this work on more Amazon sites?

It looks like https://github.com/cr7pt0gr4ph7/amazon-invoice-downloader already has a good bit of improvements to enable amazon.de, including removing quite a bit of language specific items.

I've emailed the owner to see if they're interested in collaborating as well since it won't let me mention them here.