Lets assume the official WordPress Import/Export Plugin does not work on every host as well as on localhost. Lets assume it is possible to import the posts, but not the media. Lets assume WordPress.com does not offer a free possibility to download all the media from their site.
http://example.com/ is currently hosted on WordPress.com
Tons of uploaded images are hosted like this:
https://example.files.wordpress.com/2014/11/1.png
https://example.files.wordpress.com/2015/11/1.png
and so on….
Possibility 1: Is there a Tool which can download all the images hosted on the blog while preserving the folder structure (I did not find one yet).
Possibility 2: Is there a possibility to download all media (especially images) from WordPress.com with the XML export files, but without the official WordPress Importer Tool (without having to write a custom parser for the XML-files).
With a simple search/replace on the database one could replace the host in the database and upload the extracted images. A better solution is welcome, too.
Solved this with the following script. This may be helpful for everybody having the same problem:
(index.php)
(functions.php)