dcwangmit01 / amazon-invoice-downloader

Automatically download Amazon Invoices as PDFs
MIT License
20 stars 9 forks source link

Amazon UK version? #4

Open figjamalba opened 4 months ago

figjamalba commented 4 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 4 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 4 months ago

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

cypris75 commented 3 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 3 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.