質問編集履歴

1

ソースコード更新いたしました

2021/05/14 07:19

投稿

pikachu1
pikachu1

スコア9

test CHANGED
File without changes
test CHANGED
@@ -28,7 +28,7 @@
28
28
 
29
29
  AttributeError Traceback (most recent call last)
30
30
 
31
- <ipython-input-22-f0571655c0ec> in <module>
31
+ <ipython-input-29-f0571655c0ec> in <module>
32
32
 
33
33
  9 a = soup.find(class_='s-main-slot s-result-list s-search-results sg-row')
34
34
 
@@ -66,23 +66,27 @@
66
66
 
67
67
  ```ここに言語名を入力
68
68
 
69
- url="" #該当のページ
69
+ url="該当のURL"
70
70
 
71
71
  browser.get(url)
72
72
 
73
73
  browser.implicitly_wait(10)
74
74
 
75
- r = browser.page_source #ページ情報を取得
75
+ r = browser.page_source
76
76
 
77
- browser.quit()
77
+ # browser.quit()
78
78
 
79
- soup=BeautifulSoup(r,features='lxml') #
79
+ soup=BeautifulSoup(r,features='lxml')
80
+
81
+ r = browser.page_source
82
+
83
+ soup=BeautifulSoup(r,features='lxml')
80
84
 
81
85
  a = soup.find(class_='s-main-slot s-result-list s-search-results sg-row')
82
86
 
83
- b = list_na.find_all(class_='該当のクラス')
87
+ b = a.find_all(class_='sg-col-4-of-12 s-result-item s-asin sg-col-4-of-16 sg-col sg-col-4-of-20')
84
88
 
85
- c = list_na.find_all(class_='bより下の階層での該当のクラス')
89
+ c = b.find_all(class_='a-size-base-plus a-color-base a-text-normal')
86
90
 
87
91
  c
88
92