From 17713ea60a87fd13e65adf5467bc761b65e61abd Mon Sep 17 00:00:00 2001 From: Junjie Tao Date: Thu, 2 Jun 2016 20:09:33 -0500 Subject: [PATCH] Update 1-getPageMedia.py ```python elif source.startswith("www."): url = "http://" + source[4:] ``` assignment error --- chapter5/1-getPageMedia.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/chapter5/1-getPageMedia.py b/chapter5/1-getPageMedia.py index 02869a8..9a5ba37 100644 --- a/chapter5/1-getPageMedia.py +++ b/chapter5/1-getPageMedia.py @@ -12,8 +12,7 @@ def getAbsoluteURL(baseUrl, source): elif source.startswith("http://"): url = source elif source.startswith("www."): - url = source[4:] - url = "http://"+source + url = "http://" + source[4:] else: url = baseUrl+"/"+source if baseUrl not in url: @@ -39,4 +38,4 @@ def getDownloadPath(baseUrl, absoluteUrl, downloadDirectory): fileUrl = getAbsoluteURL(baseUrl, download["src"]) if fileUrl is not None: print(fileUrl) - urlretrieve(fileUrl, getDownloadPath(baseUrl, fileUrl, downloadDirectory)) \ No newline at end of file + urlretrieve(fileUrl, getDownloadPath(baseUrl, fileUrl, downloadDirectory))