Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #60698

Downloading/Saving to a Directory

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed1.swip.net!uio.no!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <wishingforsam@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.047
X-Spam-Evidence '*H*': 0.91; '*S*': 0.00; 'sys': 0.07; 'except:': 0.09; 'try:': 0.09; 'def': 0.12; 'question.': 0.14; 'direction?': 0.16; 'main():': 0.16; 'next.': 0.16; 'urllib': 0.16; '8bit%:5': 0.22; 'import': 0.22; 'print': 0.22; "i've": 0.25; 'script': 0.25; 'subject:/': 0.26; '8bit%:3': 0.30; 'message-id:@mail.gmail.com': 0.30; "i'm": 0.30; 'code': 0.31; 'allows': 0.31; 'computer.': 0.33; 'skip:d 20': 0.34; 'created': 0.35; 'received:google.com': 0.35; 'really': 0.36; 'done': 0.36; 'hi,': 0.36; 'should': 0.36; 'wrong': 0.37; 'skip:& 10': 0.38; '8bit%:4': 0.38; 'to:addr :python-list': 0.38; 'little': 0.38; 'to:addr:python.org': 0.39; '8bit%:6': 0.40; 'how': 0.40; 'skip:u 10': 0.60; 'tell': 0.60; 'save': 0.62; 'kind': 0.63; 'become': 0.64; 'webpage': 0.68; 'skip:r 30': 0.69; '"downloading': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=Mj981Qix/RtGf6WOX4CIPJeAg2zEVEyvalevvmsr2Z4=; b=y+XOhAAKZyuzmgVJBbStznJy8XditYWrF3iwudkjT9ZKTzFXos4t22lpAGw+GTppJI Almiq6OhM0aRwQdL0V1KQPxIrzOjLxvjwm/FpXG0Kfg4HXH7BUqZ+QE1TLOmFcx9vJzv AjEseHaPLReaXr9EQDckl2BnJy5xJ0mrtCPxxiIpy9eQH5yGDzuqDJJgvr1Mkwq6Hu8r K47iqs2soxzXkUSwyLmugp9AJW4umP74jzEsL5eCA99y8464AL+pClzsNz8SDHLuGdV2 lOHK/kJ/r+oi7VUljPSgCVMQeh1mpgI12WG2CTMFm0FWQ+Ejb6jYhZFLkEDg0mnVSbNm wmCQ==
MIME-Version 1.0
X-Received by 10.194.193.39 with SMTP id hl7mr62335wjc.91.1385651988141; Thu, 28 Nov 2013 07:19:48 -0800 (PST)
Date Thu, 28 Nov 2013 15:19:48 +0000
Subject Downloading/Saving to a Directory
From "TheRandomPast ." <wishingforsam@gmail.com>
To python-list@python.org
Content-Type multipart/alternative; boundary=047d7bae4922891d1804ec3e3e1d
X-Mailman-Approved-At Thu, 28 Nov 2013 16:50:57 +0100
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3359.1385653859.18130.python-list@python.org> (permalink)
Lines 77
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1385653859 news.xs4all.nl 15882 [2001:888:2000:d::a6]:47403
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:60698

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

Hi,

I've created a script that allows me to see how many images are on a
webpage and their URL however now I want to download all .jpg images from
this website and save them onto my computer. I've never done this before
and I've become a little confused as to where I should go next. Can some
kind person take a look at my code and tell me if I'm completely in the
wrong direction?

Just to clarify what I want to do is download all .jpg images on
dogpicturesite.com and save them to a directory on my computer.

Sorry if this is a really stupid question.

import traceback
import sys
from urllib import urlretrieve

try:

        print ' imagefiles()'
        images = re.findall(r'([-\w]+\.(?:jpg))', webpage)
        urlretrieve('http://dogpicturesite.com/', 'C:/images)
        print "Downloading Images....."
        time.sleep(5)
        print "Images Downloaded."
except:
        print "Failed to Download Images"
        raw_input('Press Enter to exit...')
        sys.exit()

def main():
    sys.argv.append('http://dogpicturesite.com/')
    if len(sys.argv) != 2:
        print '[-] Image Files'
        return
    page = webpage.webpage(sys.argv[1])
    imagefiles(webpage)

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Downloading/Saving to a Directory "TheRandomPast ." <wishingforsam@gmail.com> - 2013-11-28 15:19 +0000

csiph-web