How to download a full webpage with a Python script?

前端 未结 4 2020
星月不相逢
星月不相逢 2020-12-09 18:36

Currently I have a script that can only download the HTML of a given page.

Now I want to download all the files of the web page

4条回答
  •  被撕碎了的回忆
    2020-12-09 18:59

    You can easily do that with simple python library pywebcopy.

    For Current version: 5.0.1

    
    from pywebcopy import save_webpage
    
    url = 'http://some-site.com/some-page.html'
    download_folder = '/path/to/downloads/'    
    
    kwargs = {'bypass_robots': True, 'project_name': 'recognisable-name'}
    
    save_webpage(url, download_folder, **kwargs)
    
    

    You will have html, css, js all at your download_folder. Completely working like original site.

提交回复
热议问题