Example of fint-shop's parsing
This commit is contained in:
@@ -1,17 +1,46 @@
|
||||
from currency import Currency
|
||||
import sys
|
||||
|
||||
import requests
|
||||
from bs4 import BeautifulSoup
|
||||
from currency import Currency
|
||||
from item import Item
|
||||
|
||||
url = "https://irose-shop.net/?category_id=52b1abaf8a56103f0500013e"
|
||||
items = []
|
||||
|
||||
bank = Currency("JPY")
|
||||
if not bank.status:
|
||||
print("Not correct currency code")
|
||||
sys.exit()
|
||||
|
||||
url = "https://www.fint-shop.com/c/all/bag?top_category"
|
||||
|
||||
response = requests.get(url)
|
||||
response.raise_for_status()
|
||||
|
||||
soup = BeautifulSoup(response.text, "html.parser")
|
||||
|
||||
products = soup.find_all("div", class_="c-itemList__item")
|
||||
print(products)
|
||||
# bank = Currency("JPY")
|
||||
# price = 19160
|
||||
products = soup.find_all("article", class_="fs-c-productList__list__item")
|
||||
category_name = soup.find_all("li", class_="fs-c-breadcrumb__listItem")[1].get_text(
|
||||
strip=True
|
||||
)
|
||||
print(category_name)
|
||||
for product in products:
|
||||
product_name = product.find("span", class_="fs-c-productName__name").get_text(
|
||||
strip=True
|
||||
)
|
||||
|
||||
# print(f"Price in Russian Rubles: {price * ((bank.yen_rate/bank.yen_nominal))}")
|
||||
price = int(
|
||||
product.find("div", class_="fs-c-productPrice--listed")
|
||||
.find("span", class_="fs-c-price__value")
|
||||
.get_text(strip=True)
|
||||
.replace(",", "")
|
||||
)
|
||||
product_price = round(price * (bank.rate / bank.nominal), 2)
|
||||
|
||||
product_photo = product.find(
|
||||
"img", class_="fs-c-productListItem__image__image fs-c-productImage__image"
|
||||
)["data-layzr"]
|
||||
items.append(Item(product_name, "bags", product_price, product_photo))
|
||||
|
||||
for item in items:
|
||||
print(f"Name = {item.name}, price = {item.price}")
|
||||
|
||||
Reference in New Issue
Block a user