Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7007671
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:38:15+00:00 2026-05-27T21:38:15+00:00

i use this script to download images from the same html page. But if

  • 0

i use this script to download images from the same html page. But if images large enough, this script doesnt download properly – all images are 1,15 Kb and dont display.
How can i fix it? what’s wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T21:38:16+00:00Added an answer on May 27, 2026 at 9:38 pm

    If you download and inspect the HTML in http://tema.ru/travel/new-york.2011.11/, you see things like

    <img src="IMG_5072.jpg" alt="" width="1000" height="667" border="1" />
    

    So this page is using relative links.

    The line

    parsed[2] = image["src"]
    

    changes parsed from

    ['http', 'tema.ru', '/travel/new-york.2011.11/', '', '', '']
    

    to

    ['http', 'tema.ru', 'IMG_5072.jpg', '', '', '']
    

    and then forms the new url with

    url = urlparse.urlunparse(parsed)
    

    which sets url to http://tema.ru/IMG_5072.jpg which does not exist.
    The correct url is http://tema.ru/travel/new-york.2011.11/IMG_5072.jpg.

    We can form that url with

    url = urlparse.urljoin(base_url,image['src'])
    

    so try

    """
    http://stackoverflow.com/a/258511/190597
    Author: Ryan Ginstrom
    dumpimages.py
        Downloads all the images on the supplied URL, and saves them to the
        specified output file ("/tmp" by default)
    
    Usage:
        python dumpimages.py http://example.com/ [output]
    """
    import os
    import sys
    import urllib
    import urllib2
    import urlparse
    import argparse
    import BeautifulSoup
    
    def main(base_url, out_folder):
        """Downloads all the images at 'url' to out_folder"""
        soup = BeautifulSoup.BeautifulSoup(urllib2.urlopen(base_url))
        for image in soup.findAll("img"):
            src = image['src']
            print "Image: {s}".format(s=src) 
            _, filename = os.path.split(urlparse.urlsplit(src).path)
            outpath = os.path.join(out_folder, filename)
            url = urlparse.urljoin(base_url, src)
            urllib.urlretrieve(url, outpath)
    
    if __name__ == "__main__":
        parser = argparse.ArgumentParser()
        parser.add_argument('url')
        parser.add_argument('out_folder', nargs = '?', default = '/tmp')
        args = parser.parse_args()
        main(args.url, args.out_folder)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I used this great script for an older project to download images to use
This is from a sql script. What tool can generate this? Thanks --USE [MY_TABLE]
I use this script to equalize heights of elements: (function ($) { $.fn.autoheight =
I used to use this script for jquery email obfuscation: $(.replaceAt).replaceWith(@); $(.obfuscate).each(function () {
During development, I use this to load the latest jQuery: <script src=http://www.google.com/jsapi></script> <script type=text/javascript>
I have this .bat script which I use to maven package my application. Problem
I'm puzzled with this test script: #!perl use strict; use warnings; use encoding 'utf8';
I've got this simple Perl script: #! /usr/bin/perl -w use strict; use Data::Dumper; my
I wanted to use groovy for a little ftp script and found this post
This question is simple. What function would I use in a PHP script to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.