Showing
2 changed files
with
3 additions
and
4 deletions
1 | import time | 1 | import time |
2 | -import selenium | ||
3 | from selenium import webdriver | 2 | from selenium import webdriver |
4 | from selenium.webdriver.common.keys import Keys | 3 | from selenium.webdriver.common.keys import Keys |
5 | -from config.admin import ID, PW | 4 | +from config.admin import ID, PW, LOCAL_PROJECT_PATH |
6 | from config.URLs import INSTAGRAM_URL | 5 | from config.URLs import INSTAGRAM_URL |
7 | from config.firebase import update_data | 6 | from config.firebase import update_data |
8 | 7 | ||
9 | def check_people(driver, type): | 8 | def check_people(driver, type): |
10 | result = [] | 9 | result = [] |
11 | - | ||
12 | navigations = driver.find_elements_by_class_name('-nal3') | 10 | navigations = driver.find_elements_by_class_name('-nal3') |
13 | 11 | ||
14 | if type == "followers": | 12 | if type == "followers": |
... | @@ -44,11 +42,12 @@ def get_list(insta_id, driver): | ... | @@ -44,11 +42,12 @@ def get_list(insta_id, driver): |
44 | # check followings | 42 | # check followings |
45 | following_list = check_people(driver, "following") | 43 | following_list = check_people(driver, "following") |
46 | 44 | ||
45 | + # update at firebase | ||
47 | update_data(insta_id, followers_list, following_list) | 46 | update_data(insta_id, followers_list, following_list) |
48 | 47 | ||
49 | 48 | ||
50 | def crawler_instagram(insta_id): | 49 | def crawler_instagram(insta_id): |
51 | - driver = webdriver.Chrome(executable_path='/Users/choewonseog/Documents/check-your-instagram/crawler/chromedriver') | 50 | + driver = webdriver.Chrome(executable_path=LOCAL_PROJECT_PATH + '/crawler/chromedriver') |
52 | driver.get(url=INSTAGRAM_URL) | 51 | driver.get(url=INSTAGRAM_URL) |
53 | time.sleep(4) | 52 | time.sleep(4) |
54 | 53 | ... | ... |
-
Please register or login to post a comment