-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
56 lines (38 loc) · 1.36 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
from bs4 import BeautifulSoup
import requests
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
url = 'https://www.amazon.com/s?k=headphones&ref=nb_sb_noss_2'
driver = webdriver.Chrome()
wait = WebDriverWait(driver,3)
presence =EC.presence_of_element_located
visible = EC.visibility_of_element_located
driver.get(url)
bf = BeautifulSoup(driver.page_source,'lxml')
products=[]
orginal_price=[]
prices=[]
for search in bf.find_all('div', class_ ='a-section a-spacing-medium'):
result = search.find('a', class_='a-link-normal a-text-normal').text
print(result)
products.append(result)
f.write(result)
try:
price = search.find('span', class_='a-offscreen').text
print("Orjinal fiyatı",price)
orginal_price.append(price)
f.write(price)
except AttributeError:
print("değeri yok")
for kar in orginal_price:
add = kar * 10
add = int(add) / 100
prices.append(kar+add)
print(kar)