rajatomar788 / pywebcopy

Locally saves webpages to your hard disk with images, css, js & links as is.
https://rajatomar788.github.io/pywebcopy/
Other
520 stars 105 forks source link

Svg compression issue fixed #111

Closed aodmrz closed 1 year ago

aodmrz commented 1 year ago

I noticed that most of the external svg files are not downloading properly.

For example; When you try to download https://developer.android.com/, svg files are downloaded but not displayed properly.

Executed code;

from pywebcopy import save_webpage
import os

mainPath = os.path.dirname(os.path.realpath(__file__))
os.chdir(mainPath)

save_webpage(
    url="https://developer.android.com/",
    project_folder=mainPath + "/export",
    project_name="my_site",
    bypass_robots=True,
    debug=False,
    open_in_browser=True,
    delay=None,
    threaded=False,
)

So, I did a bit of digging through the code and found that the problem was that the gzip compressed version of svg files were saved with the ".svg" extensions. I made a few additions to the relevant places in the elements.py file and problem solved.