buchhalter-ai / buchhalter-ai-cli

The buchhalter open-source command line tool to automate invoice downloads from suppliers. Free, customizable, and designed for seamless financial workflow integration.
https://buchhalter.ai
Other
4 stars 1 forks source link

Implement Download Invoice, if download header `Content-Disposition: attachment` is not sent #50

Open andygrunwald opened 4 months ago

andygrunwald commented 4 months ago

I have set up a dummy webpage: https://andygrunwald.github.io/download-example-page/

The basic idea was to test our download mechanism to verify https://github.com/buchhalter-ai/buchhalter-ai-cli/issues/49.

Create the following file _local/recipes/download-dummy.json:

{
  "provider": "download-dummy",
  "domains": [
    "https://andygrunwald.github.io/download-example-page/"
  ],
  "type": "browser",
  "steps": [
    {
      "action": "open",
      "url": "https://andygrunwald.github.io/download-example-page/",
      "description": "Open the login page."
    },
    {
      "action": "waitFor",
      "selector": "#headline",
      "description": "Wait for #headline to appear."
    },
    {
      "action": "downloadAll",
      "selector": "a.link",
      "description": "Click PDF links."
    },
    {
      "action": "move",
      "value": "file-[0-9]*.pdf",
      "description": "Move invoice pdfs."
    }
  ]
}

Add a 1Password-Item as credentials (even if we don't use them, we need the connection):

Screenshot 2024-05-19 at 12 38 44

Goal is: To download all 10 PDFs in a single run.

We need some new / additional download logic. Maybe https://github.com/chromedp/examples/blob/master/download_image/main.go ?

Maybe we intercept the original request? https://github.com/chromedp/chromedp/issues/713