Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write a script that takes this plaintext file as an argument and down… #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions downloadImages.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/python

import sys
import os.path
import utils
from fileDownloader import getFiles

if len(sys.argv) not in (2, 3):
print('Usage: %s <path> [extensions]' %sys.argv[0])
sys.exit(1)

path = os.path.abspath(sys.argv[1])
if len(sys.argv) > 2:
# pipe sign is reserved in bash, so replace it
extensions = sys.argv[2].replace(',','|')
else:
extensions = utils.DEFAULT_EXTENSIONS_REGEX

extCompile = utils.regexCompile(utils.extensionify(extensions))

getFiles(url=path, extCompile=extCompile, recursionDepth=1, httpDomain='file://')

6 changes: 6 additions & 0 deletions test.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
http://www.blue-yonder.com/images/images_portal/site/blue-yonder-logo.png
http://www.ottogroup.com/media/img/7-Konzernfirmen/Blue-Yonder/BlueYonder_Logo_Claim.jpg
http://www.blue-yonder.com/images/images_portal/site/blue-yonder-logo-one.png
http://www.goettinger-marketingtag.de/wp-content/uploads/2014/06/blueyonder.jpg
http://a2.tvspielfilm.de/imedia/1631/2301631,CAy56Rwu1NrBC7b01Hj51sy_bKkE2K8SKJaTxFPaHy4ukgr0i6X53wH4ohwA3gAOZmSGjIltu8m8+putdBgbSg==.jpg