質問編集履歴
1
コードの変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -80,13 +80,13 @@
|
|
80
80
|
|
81
81
|
##取得したリンクに遷移し、そのページのHTMLを取得
|
82
82
|
|
83
|
-
soup2 = bs4.BeautifulSoup(driver.page_source, 'html.parser')
|
84
|
-
|
85
|
-
soup3 = bs4.BeautifulSoup(driver.page_source, 'html.parser')
|
86
|
-
|
87
83
|
explanations = []
|
88
84
|
|
89
85
|
related_terms = []
|
86
|
+
|
87
|
+
elems_explanation = driver.find_elements_by_css_selector('#body')
|
88
|
+
|
89
|
+
elems_related_term = driver.find_elements_by_css_selector('#body')
|
90
90
|
|
91
91
|
for explain_url_list in explain_urls:
|
92
92
|
|
@@ -94,17 +94,19 @@
|
|
94
94
|
|
95
95
|
sleep(30)
|
96
96
|
|
97
|
-
for explanation in s
|
97
|
+
for elem_explanation in elems_explanation:
|
98
98
|
|
99
|
-
explanation
|
99
|
+
explanation = elem_explanation.get_attribute('p')
|
100
100
|
|
101
|
-
|
101
|
+
explanations.append(explanation)
|
102
102
|
|
103
|
+
for elem_related_term in elems_related_term:
|
104
|
+
|
105
|
+
related_term = elem_related_term.get_attribute('a')
|
106
|
+
|
103
|
-
related_terms.append(related_term
|
107
|
+
related_terms.append(related_term)
|
104
108
|
|
105
109
|
driver.back()
|
106
|
-
|
107
|
-
|
108
110
|
|
109
111
|
|
110
112
|
|