-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
31 lines (23 loc) · 915 Bytes
/
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
from scholar import ScholarDriver
from argparse import ArgumentParser
def parse_args():
parser = ArgumentParser()
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument("-an", "--author-name", dest="author_name", help="search for name of author")
group.add_argument("-u", "--url", dest="url", help="url of author")
parser.add_argument("-o", "--output", dest="output", help="output file name", default="output.csv")
args = parser.parse_args()
return args
if __name__ == "__main__":
args = parse_args()
driver = ScholarDriver()
if args.author_name:
driver.search_author(args.author_name)
data = driver.get_all_publications()
elif args.url:
data = driver.get_all_publications(args.url)
else:
print("please enter a valid argument")
if args.output:
driver.save_data(args.output)
print("done")