-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
45 lines (32 loc) · 1.25 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env python3
########################################
# Image Downloader from Search Engines #
########################################
# @author: Abdur R. Fayjie
# @email. [email protected]
# @date: 18-02-2023, Sat
import os
from pyimg_downloader import PyImgDownloader
from utils.parser import get_parser
if __name__ == '__main__':
args = get_parser()
pid = PyImgDownloader(search_engine=args.engine,
search_query=args.query,
n_images=args.n_images,
log=args.log
)
if args.engine == 'Google':
save_dir_path = './Images/Google/'
if not os.path.exists(save_dir_path):
os.makedirs(save_dir_path)
pid.download_google_images(save_dir=save_dir_path)
if args.engine == 'Bing':
save_dir_path = './Images/Bing/'
if not os.path.exists(save_dir_path):
os.makedirs(save_dir_path)
pid.download_bing_images(save_dir=save_dir_path)
if args.engine == 'DuckDuckGo':
save_dir_path = './Images/DuckDuckGo/'
if not os.path.exists(save_dir_path):
os.makedirs(save_dir_path)
pid.download_duckduckgo_images(save_dir=save_dir_path)