scraper2-hj3415 0.2.2__py3-none-any.whl → 0.2.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- scraper2_hj3415/nfscrapy/nfs/spiders/c103.py +31 -28
- scraper2_hj3415/nfscrapy/nfs/spiders/c104.py +47 -46
- scraper2_hj3415/nfscrapy/nfs/spiders/c106.py +25 -21
- scraper2_hj3415/nfscrapy/nfs/spiders/common.py +18 -3
- {scraper2_hj3415-0.2.2.dist-info → scraper2_hj3415-0.2.5.dist-info}/METADATA +1 -1
- {scraper2_hj3415-0.2.2.dist-info → scraper2_hj3415-0.2.5.dist-info}/RECORD +9 -9
- {scraper2_hj3415-0.2.2.dist-info → scraper2_hj3415-0.2.5.dist-info}/WHEEL +0 -0
- {scraper2_hj3415-0.2.2.dist-info → scraper2_hj3415-0.2.5.dist-info}/entry_points.txt +0 -0
- {scraper2_hj3415-0.2.2.dist-info → scraper2_hj3415-0.2.5.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import logging
|
|
1
2
|
import time
|
|
2
3
|
import scrapy
|
|
3
4
|
from util_hj3415 import utils
|
|
@@ -46,22 +47,24 @@ class C103Spider(scrapy.Spider, metaclass=ABCMeta):
|
|
|
46
47
|
|
|
47
48
|
def parse_c103(self, response, code):
|
|
48
49
|
# 페이지를 먼저 한번 호출하여 버튼을 눌러 세팅한다.
|
|
49
|
-
self.setting_page(response.url)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
50
|
+
if self.setting_page(response.url):
|
|
51
|
+
# html에서 table을 추출하여 dataframe생성
|
|
52
|
+
self.driver.get(response.url)
|
|
53
|
+
time.sleep(self.WAIT)
|
|
54
|
+
html = Selector(text=self.driver.page_source)
|
|
55
|
+
table_xpath = '//table[2]'
|
|
56
|
+
df = common.get_df_from_html(html, table_xpath, 1)
|
|
57
|
+
self.logger.debug(df)
|
|
58
|
+
|
|
59
|
+
# make item to yield
|
|
60
|
+
item = items.C103items()
|
|
61
|
+
item['코드'] = code
|
|
62
|
+
item['title'] = self.title
|
|
63
|
+
item['df'] = df
|
|
64
|
+
yield item
|
|
65
|
+
else:
|
|
66
|
+
self.logger.warning("Pasing error ... maybe 올바른 종목이 아닙니다.")
|
|
67
|
+
|
|
65
68
|
|
|
66
69
|
@abstractmethod
|
|
67
70
|
def setting_page(self, url: str):
|
|
@@ -90,13 +93,13 @@ class C103BQ(C103Spider):
|
|
|
90
93
|
def __init__(self, code, mongo_client):
|
|
91
94
|
super(C103BQ, self).__init__(code, mongo_client, title='재무상태표q')
|
|
92
95
|
|
|
93
|
-
def setting_page(self, url: str):
|
|
96
|
+
def setting_page(self, url: str) -> bool:
|
|
94
97
|
buttons = [
|
|
95
98
|
('재무상태표', '//*[@id="rpt_tab2"]'),
|
|
96
99
|
('분기', '//*[@id="frqTyp1"]'),
|
|
97
100
|
('검색', '//*[@id="hfinGubun"]'),
|
|
98
101
|
]
|
|
99
|
-
common.click_buttons(self.driver, url, buttons, self.WAIT)
|
|
102
|
+
return common.click_buttons(self.driver, url, buttons, self.WAIT)
|
|
100
103
|
|
|
101
104
|
|
|
102
105
|
class C103CQ(C103Spider):
|
|
@@ -105,13 +108,13 @@ class C103CQ(C103Spider):
|
|
|
105
108
|
def __init__(self, code, mongo_client):
|
|
106
109
|
super().__init__(code, mongo_client, title='현금흐름표q')
|
|
107
110
|
|
|
108
|
-
def setting_page(self, url: str):
|
|
111
|
+
def setting_page(self, url: str) -> bool:
|
|
109
112
|
buttons = [
|
|
110
113
|
('현금흐름표', '//*[@id="rpt_tab3"]'),
|
|
111
114
|
('분기', '//*[@id="frqTyp1"]'),
|
|
112
115
|
('검색', '//*[@id="hfinGubun"]'),
|
|
113
116
|
]
|
|
114
|
-
common.click_buttons(self.driver, url, buttons, self.WAIT)
|
|
117
|
+
return common.click_buttons(self.driver, url, buttons, self.WAIT)
|
|
115
118
|
|
|
116
119
|
|
|
117
120
|
class C103IQ(C103Spider):
|
|
@@ -120,13 +123,13 @@ class C103IQ(C103Spider):
|
|
|
120
123
|
def __init__(self, code, mongo_client):
|
|
121
124
|
super().__init__(code, mongo_client, title='손익계산서q')
|
|
122
125
|
|
|
123
|
-
def setting_page(self, url: str):
|
|
126
|
+
def setting_page(self, url: str) -> bool:
|
|
124
127
|
buttons = [
|
|
125
128
|
('손익계산서', '//*[@id="rpt_tab1"]'),
|
|
126
129
|
('분기', '//*[@id="frqTyp1"]'),
|
|
127
130
|
('검색', '//*[@id="hfinGubun"]'),
|
|
128
131
|
]
|
|
129
|
-
common.click_buttons(self.driver, url, buttons, self.WAIT)
|
|
132
|
+
return common.click_buttons(self.driver, url, buttons, self.WAIT)
|
|
130
133
|
|
|
131
134
|
|
|
132
135
|
class C103BY(C103Spider):
|
|
@@ -135,13 +138,13 @@ class C103BY(C103Spider):
|
|
|
135
138
|
def __init__(self, code, mongo_client):
|
|
136
139
|
super().__init__(code, mongo_client, title='재무상태표y')
|
|
137
140
|
|
|
138
|
-
def setting_page(self, url: str):
|
|
141
|
+
def setting_page(self, url: str) -> bool:
|
|
139
142
|
buttons = [
|
|
140
143
|
('재무상태표', '//*[@id="rpt_tab2"]'),
|
|
141
144
|
('연간', '//*[@id="frqTyp0"]'),
|
|
142
145
|
('검색', '//*[@id="hfinGubun"]'),
|
|
143
146
|
]
|
|
144
|
-
common.click_buttons(self.driver, url, buttons, self.WAIT)
|
|
147
|
+
return common.click_buttons(self.driver, url, buttons, self.WAIT)
|
|
145
148
|
|
|
146
149
|
|
|
147
150
|
class C103CY(C103Spider):
|
|
@@ -150,13 +153,13 @@ class C103CY(C103Spider):
|
|
|
150
153
|
def __init__(self, code, mongo_client):
|
|
151
154
|
super().__init__(code, mongo_client, title='현금흐름표y')
|
|
152
155
|
|
|
153
|
-
def setting_page(self, url: str):
|
|
156
|
+
def setting_page(self, url: str) -> bool:
|
|
154
157
|
buttons = [
|
|
155
158
|
('현금흐름표', '//*[@id="rpt_tab3"]'),
|
|
156
159
|
('연간', '//*[@id="frqTyp0"]'),
|
|
157
160
|
('검색', '//*[@id="hfinGubun"]'),
|
|
158
161
|
]
|
|
159
|
-
common.click_buttons(self.driver, url, buttons, self.WAIT)
|
|
162
|
+
return common.click_buttons(self.driver, url, buttons, self.WAIT)
|
|
160
163
|
|
|
161
164
|
|
|
162
165
|
class C103IY(C103Spider):
|
|
@@ -165,10 +168,10 @@ class C103IY(C103Spider):
|
|
|
165
168
|
def __init__(self, code, mongo_client):
|
|
166
169
|
super().__init__(code, mongo_client, title='손익계산서y')
|
|
167
170
|
|
|
168
|
-
def setting_page(self, url: str):
|
|
171
|
+
def setting_page(self, url: str) -> bool:
|
|
169
172
|
buttons = [
|
|
170
173
|
('손익계산서', '//*[@id="rpt_tab1"]'),
|
|
171
174
|
('연간', '//*[@id="frqTyp0"]'),
|
|
172
175
|
('검색', '//*[@id="hfinGubun"]'),
|
|
173
176
|
]
|
|
174
|
-
common.click_buttons(self.driver, url, buttons, self.WAIT)
|
|
177
|
+
return common.click_buttons(self.driver, url, buttons, self.WAIT)
|
|
@@ -46,36 +46,37 @@ class C104Spider(scrapy.Spider, metaclass=ABCMeta):
|
|
|
46
46
|
|
|
47
47
|
def parse_c104(self, response, code):
|
|
48
48
|
# 페이지를 먼저 한번 호출하여 버튼을 눌러 세팅한다.
|
|
49
|
-
self.setting_page(response.url)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
49
|
+
if self.setting_page(response.url):
|
|
50
|
+
# html에서 table을 추출하여 dataframe생성
|
|
51
|
+
self.driver.get(response.url)
|
|
52
|
+
time.sleep(self.WAIT)
|
|
53
|
+
html = Selector(text=self.driver.page_source)
|
|
54
|
+
table_xpath = '//table[@class="gHead01 all-width data-list"]'
|
|
55
|
+
|
|
56
|
+
# 테이블명을 _을 기준으로 나눠 리스트를 만든다.
|
|
57
|
+
title_list = self.title.split('_')
|
|
58
|
+
self.logger.debug(title_list)
|
|
59
|
+
|
|
60
|
+
# dataframe 리스트를 만든다.
|
|
61
|
+
df_list = []
|
|
62
|
+
for i in range(2):
|
|
63
|
+
# 상위테이블 0, 하위테이블 1
|
|
64
|
+
df_list.append(common.get_df_from_html(html, table_xpath, i))
|
|
65
|
+
self.logger.debug(df_list)
|
|
66
|
+
|
|
67
|
+
# 테이블명리스트와 df리스트를 매치하여 데이터베이스에 저장하기 위해 yield시킴
|
|
68
|
+
for title, df in list(zip(title_list, df_list)):
|
|
69
|
+
# df를 log로 출력한다.
|
|
70
|
+
self.logger.info(title)
|
|
71
|
+
self.logger.debug(df)
|
|
72
|
+
# make item to yield
|
|
73
|
+
item = items.C104items()
|
|
74
|
+
item['코드'] = code
|
|
75
|
+
item['title'] = title
|
|
76
|
+
item['df'] = df
|
|
77
|
+
yield item
|
|
78
|
+
else:
|
|
79
|
+
self.logger.warning("Pasing error ... maybe 올바른 종목이 아닙니다.")
|
|
79
80
|
|
|
80
81
|
@abstractmethod
|
|
81
82
|
def setting_page(self, url: str):
|
|
@@ -110,7 +111,7 @@ class C104AQ(C104Spider):
|
|
|
110
111
|
def __init__(self, code, mongo_client):
|
|
111
112
|
super(C104AQ, self).__init__(code, mongo_client, title='수익성q_가치분석q')
|
|
112
113
|
|
|
113
|
-
def setting_page(self, url: str):
|
|
114
|
+
def setting_page(self, url: str) -> bool:
|
|
114
115
|
buttons = [
|
|
115
116
|
('수익성', '//*[ @id="val_tab1"]'),
|
|
116
117
|
('분기', '//*[@id="frqTyp1"]'),
|
|
@@ -118,7 +119,7 @@ class C104AQ(C104Spider):
|
|
|
118
119
|
('가치분석분기', '//*[@id="frqTyp1_2"]'),
|
|
119
120
|
('가치분석검색', '//*[@id="hfinGubun2"]'),
|
|
120
121
|
]
|
|
121
|
-
common.click_buttons(self.driver, url, buttons, self.WAIT)
|
|
122
|
+
return common.click_buttons(self.driver, url, buttons, self.WAIT)
|
|
122
123
|
|
|
123
124
|
|
|
124
125
|
class C104BQ(C104Spider):
|
|
@@ -127,13 +128,13 @@ class C104BQ(C104Spider):
|
|
|
127
128
|
def __init__(self, code, mongo_client):
|
|
128
129
|
super(C104BQ, self).__init__(code, mongo_client, title='성장성q')
|
|
129
130
|
|
|
130
|
-
def setting_page(self, url: str):
|
|
131
|
+
def setting_page(self, url: str) -> bool:
|
|
131
132
|
buttons = [
|
|
132
133
|
('성장성', '//*[ @id="val_tab2"]'),
|
|
133
134
|
('분기', '//*[@id="frqTyp1"]'),
|
|
134
135
|
('검색', '//*[@id="hfinGubun"]'),
|
|
135
136
|
]
|
|
136
|
-
common.click_buttons(self.driver, url, buttons, self.WAIT)
|
|
137
|
+
return common.click_buttons(self.driver, url, buttons, self.WAIT)
|
|
137
138
|
|
|
138
139
|
|
|
139
140
|
class C104CQ(C104Spider):
|
|
@@ -142,13 +143,13 @@ class C104CQ(C104Spider):
|
|
|
142
143
|
def __init__(self, code, mongo_client):
|
|
143
144
|
super(C104CQ, self).__init__(code, mongo_client, title='안정성q')
|
|
144
145
|
|
|
145
|
-
def setting_page(self, url: str):
|
|
146
|
+
def setting_page(self, url: str) -> bool:
|
|
146
147
|
buttons = [
|
|
147
148
|
('안정성', '//*[ @id="val_tab3"]'),
|
|
148
149
|
('분기', '//*[@id="frqTyp1"]'),
|
|
149
150
|
('검색', '//*[@id="hfinGubun"]'),
|
|
150
151
|
]
|
|
151
|
-
common.click_buttons(self.driver, url, buttons, self.WAIT)
|
|
152
|
+
return common.click_buttons(self.driver, url, buttons, self.WAIT)
|
|
152
153
|
|
|
153
154
|
|
|
154
155
|
class C104DQ(C104Spider):
|
|
@@ -157,13 +158,13 @@ class C104DQ(C104Spider):
|
|
|
157
158
|
def __init__(self, code, mongo_client):
|
|
158
159
|
super(C104DQ, self).__init__(code, mongo_client, title='활동성q')
|
|
159
160
|
|
|
160
|
-
def setting_page(self, url: str):
|
|
161
|
+
def setting_page(self, url: str) -> bool:
|
|
161
162
|
buttons = [
|
|
162
163
|
('활동성', '//*[ @id="val_tab4"]'),
|
|
163
164
|
('분기', '//*[@id="frqTyp1"]'),
|
|
164
165
|
('검색', '//*[@id="hfinGubun"]'),
|
|
165
166
|
]
|
|
166
|
-
common.click_buttons(self.driver, url, buttons, self.WAIT)
|
|
167
|
+
return common.click_buttons(self.driver, url, buttons, self.WAIT)
|
|
167
168
|
|
|
168
169
|
|
|
169
170
|
class C104AY(C104Spider):
|
|
@@ -172,7 +173,7 @@ class C104AY(C104Spider):
|
|
|
172
173
|
def __init__(self, code, mongo_client):
|
|
173
174
|
super(C104AY, self).__init__(code, mongo_client, title='수익성y_가치분석y')
|
|
174
175
|
|
|
175
|
-
def setting_page(self, url: str):
|
|
176
|
+
def setting_page(self, url: str) -> bool:
|
|
176
177
|
buttons = [
|
|
177
178
|
('수익성', '//*[ @id="val_tab1"]'),
|
|
178
179
|
('연간', '//*[@id="frqTyp0"]'),
|
|
@@ -180,7 +181,7 @@ class C104AY(C104Spider):
|
|
|
180
181
|
('가치분석연간', '//*[@id="frqTyp0_2"]'),
|
|
181
182
|
('가치분석검색', '//*[@id="hfinGubun2"]'),
|
|
182
183
|
]
|
|
183
|
-
common.click_buttons(self.driver, url, buttons, self.WAIT)
|
|
184
|
+
return common.click_buttons(self.driver, url, buttons, self.WAIT)
|
|
184
185
|
|
|
185
186
|
|
|
186
187
|
class C104BY(C104Spider):
|
|
@@ -189,13 +190,13 @@ class C104BY(C104Spider):
|
|
|
189
190
|
def __init__(self, code, mongo_client):
|
|
190
191
|
super(C104BY, self).__init__(code, mongo_client, title='성장성y')
|
|
191
192
|
|
|
192
|
-
def setting_page(self, url: str):
|
|
193
|
+
def setting_page(self, url: str) -> bool:
|
|
193
194
|
buttons = [
|
|
194
195
|
('성장성', '//*[ @id="val_tab2"]'),
|
|
195
196
|
('연간', '//*[@id="frqTyp0"]'),
|
|
196
197
|
('검색', '//*[@id="hfinGubun"]'),
|
|
197
198
|
]
|
|
198
|
-
common.click_buttons(self.driver, url, buttons, self.WAIT)
|
|
199
|
+
return common.click_buttons(self.driver, url, buttons, self.WAIT)
|
|
199
200
|
|
|
200
201
|
|
|
201
202
|
class C104CY(C104Spider):
|
|
@@ -204,13 +205,13 @@ class C104CY(C104Spider):
|
|
|
204
205
|
def __init__(self, code, mongo_client):
|
|
205
206
|
super(C104CY, self).__init__(code, mongo_client, title='안정성y')
|
|
206
207
|
|
|
207
|
-
def setting_page(self, url: str):
|
|
208
|
+
def setting_page(self, url: str) -> bool:
|
|
208
209
|
buttons = [
|
|
209
210
|
('안정성', '//*[ @id="val_tab3"]'),
|
|
210
211
|
('연간', '//*[@id="frqTyp0"]'),
|
|
211
212
|
('검색', '//*[@id="hfinGubun"]'),
|
|
212
213
|
]
|
|
213
|
-
common.click_buttons(self.driver, url, buttons, self.WAIT)
|
|
214
|
+
return common.click_buttons(self.driver, url, buttons, self.WAIT)
|
|
214
215
|
|
|
215
216
|
|
|
216
217
|
class C104DY(C104Spider):
|
|
@@ -219,10 +220,10 @@ class C104DY(C104Spider):
|
|
|
219
220
|
def __init__(self, code, mongo_client):
|
|
220
221
|
super(C104DY, self).__init__(code, mongo_client, title='활동성y')
|
|
221
222
|
|
|
222
|
-
def setting_page(self, url: str):
|
|
223
|
+
def setting_page(self, url: str) -> bool:
|
|
223
224
|
buttons = [
|
|
224
225
|
('활동성', '//*[ @id="val_tab4"]'),
|
|
225
226
|
('연간', '//*[@id="frqTyp0"]'),
|
|
226
227
|
('검색', '//*[@id="hfinGubun"]'),
|
|
227
228
|
]
|
|
228
|
-
common.click_buttons(self.driver, url, buttons, self.WAIT)
|
|
229
|
+
return common.click_buttons(self.driver, url, buttons, self.WAIT)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import time
|
|
2
2
|
import scrapy
|
|
3
3
|
import pandas as pd
|
|
4
|
+
import selenium.common.exceptions
|
|
4
5
|
from util_hj3415 import utils
|
|
5
6
|
from scrapy.selector import Selector
|
|
6
7
|
|
|
@@ -37,28 +38,31 @@ class C106Spider(scrapy.Spider):
|
|
|
37
38
|
self.driver.get(response.url)
|
|
38
39
|
# 경험상 1초는 데이터 수집에러 가능성 있었음.
|
|
39
40
|
time.sleep(self.WAIT)
|
|
40
|
-
|
|
41
|
+
try:
|
|
42
|
+
html = Selector(text=self.driver.page_source)
|
|
43
|
+
except selenium.common.exceptions.UnexpectedAlertPresentException:
|
|
44
|
+
self.logger.warning("Pasing error ... maybe 올바른 종목이 아닙니다.")
|
|
45
|
+
else:
|
|
46
|
+
# 컬럼명을 얻어 다음 request에 실어 보낸다.
|
|
47
|
+
cols = []
|
|
48
|
+
for i in range(1, 7):
|
|
49
|
+
pretitle = html.xpath(f'//*[@id="cTB611_h"]/thead/tr/th[{i}]/text()[1]').getall()[0].strip().replace('.','')
|
|
50
|
+
# 인덱스에 공칸일 경우 데이터베이스 저장시 에러가 발생하기 때문에 추가한 코드
|
|
51
|
+
if pretitle == '':
|
|
52
|
+
pretitle = 'Unnamed'
|
|
53
|
+
cols.append(pretitle)
|
|
54
|
+
self.logger.info(f'Parsing column names - {code} >>>> {cols}')
|
|
41
55
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
titles = ['y', 'q'] # pipeline에서 테이블명으로 됨
|
|
53
|
-
for title in titles:
|
|
54
|
-
# C106의 내부의 iframe주소, 분기와 연간 2개임
|
|
55
|
-
# reference from https://docs.scrapy.org/en/latest/topics/request-response.html (request 연쇄보내기)
|
|
56
|
-
yield scrapy.Request(
|
|
57
|
-
url=f'https://navercomp.wisereport.co.kr/company/cF6002.aspx?cmp_cd={code}'
|
|
58
|
-
f'&finGubun=MAIN&cmp_cd1=&cmp_cd2=&cmp_cd3=&cmp_cd4=&sec_cd=G453010&frq={title.upper()}',
|
|
59
|
-
callback=self.parse_c106,
|
|
60
|
-
cb_kwargs=dict(code=code, cols=cols, title=title)
|
|
61
|
-
)
|
|
56
|
+
titles = ['y', 'q'] # pipeline에서 테이블명으로 됨
|
|
57
|
+
for title in titles:
|
|
58
|
+
# C106의 내부의 iframe주소, 분기와 연간 2개임
|
|
59
|
+
# reference from https://docs.scrapy.org/en/latest/topics/request-response.html (request 연쇄보내기)
|
|
60
|
+
yield scrapy.Request(
|
|
61
|
+
url=f'https://navercomp.wisereport.co.kr/company/cF6002.aspx?cmp_cd={code}'
|
|
62
|
+
f'&finGubun=MAIN&cmp_cd1=&cmp_cd2=&cmp_cd3=&cmp_cd4=&sec_cd=G453010&frq={title.upper()}',
|
|
63
|
+
callback=self.parse_c106,
|
|
64
|
+
cb_kwargs=dict(code=code, cols=cols, title=title)
|
|
65
|
+
)
|
|
62
66
|
|
|
63
67
|
def parse_c106(self, response, code, cols, title):
|
|
64
68
|
df = C106Spider.get_df_from_html(response.text, cols)
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import time
|
|
2
2
|
import pandas as pd
|
|
3
3
|
from typing import Tuple, List
|
|
4
|
+
|
|
5
|
+
import selenium.common.exceptions
|
|
4
6
|
from selenium.webdriver.chrome.webdriver import WebDriver
|
|
5
7
|
from selenium.webdriver.common.by import By
|
|
6
8
|
|
|
@@ -25,15 +27,28 @@ def adjust_arg_type(code) -> list:
|
|
|
25
27
|
raise TypeError
|
|
26
28
|
|
|
27
29
|
|
|
28
|
-
def click_buttons(driver: WebDriver, url: str, buttons: List[Tuple[str, str]], wait: float):
|
|
29
|
-
|
|
30
|
+
def click_buttons(driver: WebDriver, url: str, buttons: List[Tuple[str, str]], wait: float) -> bool:
|
|
31
|
+
"""
|
|
32
|
+
하부 클래스에서 buttons 리스트를 입력받아 실제 버튼을 클릭하는 함수
|
|
33
|
+
|
|
34
|
+
:param driver:
|
|
35
|
+
:param url:
|
|
36
|
+
:param buttons:
|
|
37
|
+
:param wait:
|
|
38
|
+
:return: 함수 작업이 무사히 완료되면 True
|
|
39
|
+
"""
|
|
40
|
+
#
|
|
30
41
|
logger.debug(f'*** Setting {url} page by clicking buttons ***')
|
|
31
42
|
driver.get(url)
|
|
32
43
|
for name, xpath in buttons:
|
|
33
44
|
logger.debug(f'- Click the {name} button')
|
|
34
|
-
|
|
45
|
+
try:
|
|
46
|
+
driver.find_element(By.XPATH, xpath).click()
|
|
47
|
+
except selenium.common.exceptions.UnexpectedAlertPresentException:
|
|
48
|
+
return False
|
|
35
49
|
time.sleep(wait)
|
|
36
50
|
logger.debug('*** Buttons click done ***')
|
|
51
|
+
return True
|
|
37
52
|
|
|
38
53
|
|
|
39
54
|
def get_df_from_html(selector, xpath, table_num):
|
|
@@ -38,12 +38,12 @@ scraper2_hj3415/nfscrapy/nfs/spiders/.DS_Store,sha256=4bCeSNMYj0-03QEqosRz4reLOv
|
|
|
38
38
|
scraper2_hj3415/nfscrapy/nfs/spiders/__init__.py,sha256=ULwecZkx3_NTphkz7y_qiazBeUoHFnCCWnKSjoDCZj0,161
|
|
39
39
|
scraper2_hj3415/nfscrapy/nfs/spiders/_c108.py,sha256=gOgWQ7qTOOBEZQTY79K5MWzjmz-ZpFg5wrqBhzLoXjI,4776
|
|
40
40
|
scraper2_hj3415/nfscrapy/nfs/spiders/c101.py,sha256=-b_bC0jS_MgDP9h9n2MFHRq-wDx1CGWsgWj6-KQKnpc,3931
|
|
41
|
-
scraper2_hj3415/nfscrapy/nfs/spiders/c103.py,sha256=
|
|
42
|
-
scraper2_hj3415/nfscrapy/nfs/spiders/c104.py,sha256=
|
|
43
|
-
scraper2_hj3415/nfscrapy/nfs/spiders/c106.py,sha256=
|
|
44
|
-
scraper2_hj3415/nfscrapy/nfs/spiders/common.py,sha256=
|
|
45
|
-
scraper2_hj3415-0.2.
|
|
46
|
-
scraper2_hj3415-0.2.
|
|
47
|
-
scraper2_hj3415-0.2.
|
|
48
|
-
scraper2_hj3415-0.2.
|
|
49
|
-
scraper2_hj3415-0.2.
|
|
41
|
+
scraper2_hj3415/nfscrapy/nfs/spiders/c103.py,sha256=OUcieEOQhD4ttWwDNEFX2F65KtCHe6TOhh3slXuYqhE,5884
|
|
42
|
+
scraper2_hj3415/nfscrapy/nfs/spiders/c104.py,sha256=ugF9yEKtAfZgLDqmX7Y-y1aoIfUR81Txouda27x1Mro,7975
|
|
43
|
+
scraper2_hj3415/nfscrapy/nfs/spiders/c106.py,sha256=SRm6tJiWOCZrxvHF5LnaAXzK2Ui1U80D65JGRaGRNEM,4094
|
|
44
|
+
scraper2_hj3415/nfscrapy/nfs/spiders/common.py,sha256=Y4ENlLTuQAQjPX3z1Xco7HvFdcIUByHohs4lYMjw69Q,3218
|
|
45
|
+
scraper2_hj3415-0.2.5.dist-info/METADATA,sha256=3Am9xsWTglARO3YFF7KsVao33FieXHoJ812UIXNsrQ0,1303
|
|
46
|
+
scraper2_hj3415-0.2.5.dist-info/WHEEL,sha256=Fd6mP6ydyRguakwUJ05oBE7fh2IPxgtDN9IwHJ9OqJQ,87
|
|
47
|
+
scraper2_hj3415-0.2.5.dist-info/entry_points.txt,sha256=1bGP38AtuY6n2FcP_fLmpqGtFmFf8NLJWsCSWoTjF-0,60
|
|
48
|
+
scraper2_hj3415-0.2.5.dist-info/licenses/LICENSE,sha256=6kbiFSfobTZ7beWiKnHpN902HgBx-Jzgcme0SvKqhKY,1091
|
|
49
|
+
scraper2_hj3415-0.2.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|