回答編集履歴
1
記入ミスのため
answer
CHANGED
|
@@ -4,14 +4,12 @@
|
|
|
4
4
|
from selenium.webdriver.chrome.options import Options
|
|
5
5
|
import time,sys
|
|
6
6
|
from multiprocessing import Pool
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
#import chromedriver_binary
|
|
9
9
|
|
|
10
10
|
def fetchclass(url):
|
|
11
11
|
options = Options()
|
|
12
|
-
|
|
12
|
+
options.add_argument('--headless')
|
|
13
|
-
options.add_experimental_option("excludeSwitches", ['enable-automation'])
|
|
14
|
-
options.add_experimental_option('useAutomationExtension', False)
|
|
15
13
|
driver = webdriver.Chrome(options=options)
|
|
16
14
|
driver.get(url)
|
|
17
15
|
time.sleep(5)
|
|
@@ -32,8 +30,10 @@
|
|
|
32
30
|
|
|
33
31
|
if __name__ == "__main__":
|
|
34
32
|
|
|
35
|
-
with Pool(
|
|
33
|
+
with Pool(9) as p:
|
|
36
34
|
result = (p.map(fetchclass, urls))
|
|
35
|
+
for l in result:
|
|
37
|
-
|
|
36
|
+
sys.stdout.buffer.write(l.encode('utf-8'))
|
|
38
|
-
|
|
37
|
+
#print(l)
|
|
38
|
+
|
|
39
39
|
```
|