-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathexample.py
More file actions
32 lines (27 loc) · 720 Bytes
/
example.py
File metadata and controls
32 lines (27 loc) · 720 Bytes
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
import time
import argparse
from amazon_scraper.scraper import Scraper
def main():
"""Takes command line argument
"""
parser = argparse.ArgumentParser(
description='Extracts links contained in a url'
)
parser.add_argument(
'-w',
'--word',
nargs='*',
default='smart phone',
help='Enter the word you want to search'
)
arg = parser.parse_args()
arg.word = ''.join(arg.word)
amazon = Scraper()
amazon.search(arg.word)
if __name__ == "__main__":
print("Extracting...")
start = time.perf_counter()
main()
stop = time.perf_counter()
print("Finished Extracting...")
print(f"The extraction took {stop - start}")