回答編集履歴

3

修正

2020/09/26 12:59

投稿

kipipipi
kipipipi

スコア60

test CHANGED
@@ -110,31 +110,31 @@
110
110
 
111
111
 
112
112
 
113
- html = driver.page_source.encode('utf-8')
113
+ html = driver.page_source.encode('utf-8')
114
114
 
115
- soup = BeautifulSoup(html, "html.parser")
115
+ soup = BeautifulSoup(html, "html.parser")
116
116
 
117
- elems = soup.select('#thumbnail')
117
+ elems = soup.select('#thumbnail')
118
118
 
119
- result_video_list = []
119
+ result_video_list = []
120
120
 
121
121
 
122
122
 
123
- for elem in elems:
123
+ for elem in elems:
124
124
 
125
- result_video_list.append(elem.get("href"))
125
+ result_video_list.append(elem.get("href"))
126
126
 
127
127
 
128
128
 
129
- for test in result_video_list:
129
+ for test in result_video_list:
130
130
 
131
- try:
131
+ try:
132
132
 
133
- pprint('https://www.youtube.com' + test)
133
+ pprint('https://www.youtube.com' + test)
134
134
 
135
- except:
135
+ except:
136
136
 
137
- continue
137
+ continue
138
138
 
139
139
 
140
140
 

2

修正

2020/09/26 12:59

投稿

kipipipi
kipipipi

スコア60

test CHANGED
@@ -80,7 +80,7 @@
80
80
 
81
81
  #
82
82
 
83
- DRIVER_PATH = '/Users/nagaki/Documents/naga-sample-code/python/scraping/chromedriver'
83
+ DRIVER_PATH = 'ドライバーパス'
84
84
 
85
85
  driver = webdriver.Chrome(executable_path=DRIVER_PATH, chrome_options=options)
86
86
 

1

修正

2020/09/26 12:57

投稿

kipipipi
kipipipi

スコア60

test CHANGED
@@ -100,7 +100,7 @@
100
100
 
101
101
 
102
102
 
103
- for i in range(60): #回数は調整してください
103
+ for i in range(50): #回数は調整してください
104
104
 
105
105
  # # # 一番下までスクロールする
106
106