Showing
12 changed files
with
26 additions
and
7 deletions
__pycache__/server.cpython-37.pyc
0 → 100644
No preview for this file type
... | @@ -11,12 +11,15 @@ import Body from "./views/body/Body"; | ... | @@ -11,12 +11,15 @@ import Body from "./views/body/Body"; |
11 | import Footer from "./views/footer/Footer"; | 11 | import Footer from "./views/footer/Footer"; |
12 | 12 | ||
13 | const App = (pathname : string) : string => { | 13 | const App = (pathname : string) : string => { |
14 | + history.pushState('','', pathname); | ||
15 | + | ||
14 | let contents : string = ` | 16 | let contents : string = ` |
15 | <div> | 17 | <div> |
16 | ${Header()} | 18 | ${Header()} |
17 | hello ${pathname} | 19 | hello ${pathname} |
18 | ${Body()} | 20 | ${Body()} |
19 | ${Footer()} | 21 | ${Footer()} |
22 | + <a href="/wonseog" id="nav-button" data-link>wonseok!!</a> | ||
20 | </div> | 23 | </div> |
21 | `; | 24 | `; |
22 | 25 | ... | ... |
app/src/config/url.ts
0 → 100644
1 | +export const BASE_URL = 'http://127.0.0.1:5000/'; |
... | @@ -3,11 +3,22 @@ | ... | @@ -3,11 +3,22 @@ |
3 | * @date : 2021/03/08 | 3 | * @date : 2021/03/08 |
4 | * @description : 현재 pathname을 파악 후 App으로 전달 | 4 | * @description : 현재 pathname을 파악 후 App으로 전달 |
5 | **/ | 5 | **/ |
6 | -import App from "./App"; | 6 | +import App from './App'; |
7 | +import {BASE_URL} from './config/url'; | ||
7 | 8 | ||
8 | window.addEventListener('DOMContentLoaded', () => { | 9 | window.addEventListener('DOMContentLoaded', () => { |
9 | const $App = document.querySelector('#App'); | 10 | const $App = document.querySelector('#App'); |
10 | - let pathname = window.location.pathname.split('/')[1]; | 11 | + const pathname = window.location.pathname.split('/')[1]; |
12 | + | ||
13 | + document.body.addEventListener('click', (e) => { | ||
14 | + const target = e.target as HTMLAnchorElement; | ||
15 | + const href = target.href.split(BASE_URL)[1]; | ||
16 | + | ||
17 | + if(target.matches("[data-link]")){ | ||
18 | + e.preventDefault(); | ||
19 | + $App && ($App.innerHTML = App(href)); | ||
20 | + } | ||
21 | + }); | ||
11 | 22 | ||
12 | $App && ($App.innerHTML = App(pathname)); | 23 | $App && ($App.innerHTML = App(pathname)); |
13 | }) | 24 | }) |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
config/__pycache__/URLs.cpython-37.pyc
0 → 100644
No preview for this file type
config/__pycache__/__init__.cpython-37.pyc
0 → 100644
No preview for this file type
config/__pycache__/admin.cpython-37.pyc
0 → 100644
No preview for this file type
config/__pycache__/firebase.cpython-37.pyc
0 → 100644
No preview for this file type
crawler/__pycache__/__init__.cpython-37.pyc
0 → 100644
No preview for this file type
No preview for this file type
... | @@ -3,7 +3,7 @@ from selenium import webdriver | ... | @@ -3,7 +3,7 @@ from selenium import webdriver |
3 | from selenium.webdriver.common.keys import Keys | 3 | from selenium.webdriver.common.keys import Keys |
4 | from config.admin import ID, PW, LOCAL_PROJECT_PATH | 4 | from config.admin import ID, PW, LOCAL_PROJECT_PATH |
5 | from config.URLs import INSTAGRAM_URL | 5 | from config.URLs import INSTAGRAM_URL |
6 | -from config.firebase import update_data | 6 | +# from config.firebase import update_data |
7 | 7 | ||
8 | def check_people(driver, type): | 8 | def check_people(driver, type): |
9 | result = [] | 9 | result = [] |
... | @@ -43,7 +43,7 @@ def get_list(insta_id, driver): | ... | @@ -43,7 +43,7 @@ def get_list(insta_id, driver): |
43 | following_list = check_people(driver, "following") | 43 | following_list = check_people(driver, "following") |
44 | 44 | ||
45 | # update at firebase | 45 | # update at firebase |
46 | - update_data(insta_id, followers_list, following_list) | 46 | + # update_data(insta_id, followers_list, following_list) |
47 | 47 | ||
48 | 48 | ||
49 | def crawler_instagram(insta_id): | 49 | def crawler_instagram(insta_id): | ... | ... |
... | @@ -2,7 +2,11 @@ import os | ... | @@ -2,7 +2,11 @@ import os |
2 | from flask import Flask, render_template, request, jsonify, send_from_directory | 2 | from flask import Flask, render_template, request, jsonify, send_from_directory |
3 | from crawler.crawler_instagram import crawler_instagram | 3 | from crawler.crawler_instagram import crawler_instagram |
4 | 4 | ||
5 | -my_path = '/Users/choewonseog/Documents/check-your-instagram/app/public' | 5 | +# my_path = '/Users/choewonseog/Documents/check-your-instagram/app/public' |
6 | +# my_path = 'C:/Users/goesnow/Documents/study/check-your-instagram/app/public' | ||
7 | + | ||
8 | +root_dir = os.path.dirname(os.getcwd()) | ||
9 | +my_path = os.path.join(root_dir, 'check-your-instagram', 'app', 'public') | ||
6 | app = Flask(__name__, static_folder=os.path.abspath(my_path)) | 10 | app = Flask(__name__, static_folder=os.path.abspath(my_path)) |
7 | 11 | ||
8 | 12 | ||
... | @@ -28,8 +32,8 @@ def home(path): | ... | @@ -28,8 +32,8 @@ def home(path): |
28 | update(insta_id) | 32 | update(insta_id) |
29 | # elif path == '': | 33 | # elif path == '': |
30 | else: | 34 | else: |
31 | - root_dir = os.path.dirname(os.getcwd()) | 35 | + print() |
32 | - return send_from_directory(os.path.join(root_dir, 'check-your-instagram', 'app', 'public'), filename='index.html') | 36 | + return send_from_directory(my_path, filename='index.html') |
33 | 37 | ||
34 | 38 | ||
35 | if __name__ == "__main__": | 39 | if __name__ == "__main__": | ... | ... |
-
Please register or login to post a comment