download image from url using python urllib but receiving HTTP Error 403: Forbidden

前端 未结 3 1648
广开言路
广开言路 2020-11-27 20:44

I want to download image file from a url using python module \"urllib.request\", which works for some website (e.g. mangastream.com), but does not work for another (mangadoo

3条回答
  •  日久生厌
    2020-11-27 20:57

    I try wget with the url in terminal and it works:

    wget -O out_005.png  http://mangadoom.co/wp-content/manga/5170/886/005.png
    

    so my way around is to use the script below, and it works too.

    import os
    out_image = 'out_005.png'
    url = 'http://mangadoom.co/wp-content/manga/5170/886/005.png'
    os.system("wget -O {0} {1}".format(out_image, url))
    

提交回复
热议问题