-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
36 lines (26 loc) · 987 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
30
31
32
33
34
from selenium import webdriver
import argparse
from scrap import UdmScraper
def parse_command_line_args():
parser = argparse.ArgumentParser(description="""
parse udemy search parameters
""")
parser.add_argument('--keyword', type=str, required=True, help="""
enter the keyword you want to search for
""")
parser.add_argument('--pages', type=int, required=True, help="""
enter the number of pages you want to search
""")
return vars(parser.parse_args())
if __name__ == "__main__":
search_keys = parse_command_line_args()
# initialize selenium webdriver - pass latest chromedriver path to webdriver.Chrome()
driver = webdriver.Chrome('./chromedriver')
main_link = 'https://www.udemy.com'
driver.get(main_link)
UdmScraper = UdmScraper(driver, **search_keys)
UdmScraper.set_lang()
UdmScraper.scrap_links()
UdmScraper.make_Df()
UdmScraper.preprocessing()
UdmScraper.saveDf()