Download Tiles until level 11


I need OSM tiles for an offline application (there’s usually no internet access).
I therefore need to download them once to include them in the application (layer 0-11 should be sufficient)
I tried to download them automatically using libcurl.
However after I successfully downloaded a few tiles for testing I no longer get the pngs but an “Access denied.” response from the server.
I guess it is because some kind of misuse detection (it still works manually in the browser). But since I only need to download them once I wouldn’t consider this a misuse.
Is there any way I can download them?

I also read about setting up a custom tile server. Unfortunately with my old hardware it takes approximately 18 days until the pbf is imported into the database (judging from the current speed).

Is there any solution to this problem without buying new expensive hardware?

That is a misuse of the system if it’s not for just a really small region. Either setup your own tileserver (e.g. on rented hardware) or find a tile provider that offers tile packages for offline use.