{"id":29328486,"url":"https://github.com/dcwangmit01/amazon-invoice-downloader","last_synced_at":"2025-07-07T22:03:19.819Z","repository":{"id":186252570,"uuid":"674906485","full_name":"dcwangmit01/amazon-invoice-downloader","owner":"dcwangmit01","description":"Automatically download Amazon Invoices as PDFs","archived":false,"fork":false,"pushed_at":"2025-03-28T22:34:39.000Z","size":16,"stargazers_count":35,"open_issues_count":3,"forks_count":17,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-28T23:27:54.871Z","etag":null,"topics":["amazon","pdf","playwright","scraper","selenium"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dcwangmit01.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-05T05:57:59.000Z","updated_at":"2025-03-28T22:34:43.000Z","dependencies_parsed_at":"2024-11-16T17:38:18.567Z","dependency_job_id":"64b8e835-f49c-40ab-9ab2-04abe32ac2e6","html_url":"https://github.com/dcwangmit01/amazon-invoice-downloader","commit_stats":null,"previous_names":["dcwangmit01/amazon-invoice-downloader"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/dcwangmit01/amazon-invoice-downloader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcwangmit01%2Famazon-invoice-downloader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcwangmit01%2Famazon-invoice-downloader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcwangmit01%2Famazon-invoice-downloader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcwangmit01%2Famazon-invoice-downloader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dcwangmit01","download_url":"https://codeload.github.com/dcwangmit01/amazon-invoice-downloader/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcwangmit01%2Famazon-invoice-downloader/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264151189,"owners_count":23564693,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["amazon","pdf","playwright","scraper","selenium"],"created_at":"2025-07-07T22:01:52.450Z","updated_at":"2025-07-07T22:03:19.813Z","avatar_url":"https://github.com/dcwangmit01.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Amazon Invoice Downloader\n\n[![PyPI - Version](https://img.shields.io/pypi/v/amazon-invoice-downloader.svg)](https://pypi.org/project/amazon-invoice-downloader)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/amazon-invoice-downloader.svg)](https://pypi.org/project/amazon-invoice-downloader)\n\n-----\n\n**Table of Contents**\n\n- [Installation](#installation)\n- [License](#license)\n\n## What it does\n\n\nThis program `amazon-invoice-downloader.py` is a utility script that uses the [Playwright](https://playwright.dev/) library to spin up a Chromium instance and automate the process of downloading invoices for Amazon purchases within a specified date range. The script logs into Amazon using the provided email and password, navigates to the \"Returns \u0026 Orders\" section, and retrieves invoices for the specified year or date range.\n\nThe user can provide their Amazon login credentials either through command line arguments (--email=\u003cemail\u003e --password=\u003cpassword\u003e) or as environment variables ($AMAZON_EMAIL and $AMAZON_PASSWORD).\n\nThe script accepts the date range either as a specific year (--year=\u003cYYYY\u003e) or as a date range (--date-range=\u003cYYYYMMDD-YYYYMMDD\u003e). If no date range is provided, the script defaults to the current year.\n\nOnce the invoices are retrieved, they are saved as PDF files in a local \"downloads\" directory. The filename of each PDF is formatted as `YYYYMMDD_\u003ctotal\u003e_amazon_\u003corderid\u003e.pdf`, where YYYYMMDD is the date of the order, total is the total amount of the order (with dollar signs and commas removed), and orderid is the unique Amazon order ID.\n\nThe program has a built-in \"human latency\" function, sleep(), to mimic human behavior by introducing random pauses between certain actions. This can help prevent the script from being detected and blocked as a bot by Amazon.\n\nThe script will skip downloading a file if it already exists in the `./downloads` directory.\n\n## Installation\n\n```console\npip install amazon-invoice-downloader\nplaywright install\n```\n\n## Usage\n\nWhen running this program, Amazon may detect you are automation and introduce CAPTCHA's or make you login again.  Just do so, and once successfully logged in, the script will continue.\n\n```console\n$ amazon-invoice-downloader -h\nAmazon Invoice Downloader\n\nUsage:\n  amazon-invoice-downloader.py \\\n    [--email=\u003cemail\u003e --password=\u003cpassword\u003e] \\\n    [--year=\u003cYYYY\u003e | --date-range=\u003cYYYYMMDD-YYYYMMDD\u003e]\n  amazon-invoice-downloader.py (-h | --help)\n\nLogin Options:\n  --email=\u003cemail\u003e          Amazon login email  [default: $AMAZON_EMAIL].\n  --password=\u003cpassword\u003e    Amazon login password  [default: $AMAZON_PASSWORD].\n\nDate Range Options:\n  --date-range=\u003cYYYYMMDD-YYYYMMDD\u003e  Start and end date range\n  --year=\u003cYYYY\u003e            Year, formatted as YYYY  [default: \u003cCUR_YEAR\u003e].\n\nOptions:\n  -h --help                Show this screen.\n\nExamples:\n  amazon-invoice-downloader.py --year=2022  # This uses env vars $AMAZON_EMAIL and $AMAZON_PASSWORD\n  amazon-invoice-downloader.py --date-range=20220101-20221231\n  amazon-invoice-downloader.py --email=user@example.com --password=secret  # Defaults to current year\n  amazon-invoice-downloader.py --email=user@example.com --password=secret --year=2022\n  amazon-invoice-downloader.py --email=user@example.com --password=secret --date-range=20220101-20221231\n```\n\n\n## License\n\n`amazon-invoice-downloader` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcwangmit01%2Famazon-invoice-downloader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdcwangmit01%2Famazon-invoice-downloader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcwangmit01%2Famazon-invoice-downloader/lists"}