diff --git a/downloader.py b/downloader.py index 7703ec4..79db947 100755 --- a/downloader.py +++ b/downloader.py @@ -8,15 +8,12 @@ def fileDownloader(url, sender = False): filename = "%s/%s" % (sender, url.split('/')[-1]) else: filename = url.split('/')[-1] - if not os.path.isfile(filename): - remote = requests.get(url, stream=True) - with open(filename, 'wb') as outfile: - for chunk in remote.iter_content(chunk_size=1024): - if chunk: - outfile.write(chunk) - outfile.flush() - else: - print("File %s already exists. Skipping.", file=sys.stderr) + remote = requests.get(url, stream=True) + with open(filename, 'wb') as outfile: + for chunk in remote.iter_content(chunk_size=1024): + if chunk: + outfile.write(chunk) + outfile.flush() def urlparse(url): if "/img/usr/" in url: @@ -40,6 +37,8 @@ if __name__ == "__main__": except ValueError: print("%s is not a valid URL. Skipping." % url, file=sys.stderr) else: + if purl == urlparse(url): + print("Notice: You may have copied the image URL rather than the link URL from the message window. Use the link URL instead!") if args.get_urls: print(purl) elif args.sender: