I would like to make a python scrip, but unfortunately when I want to check the price, I get NONE instead of the price itself (or US$00.00 if i change the code) Found a lot of example for it, where the HTML is with id, but i do not know how should I do it with class.
P.S.: I'm pretty new to python, so all kind of help are well appreciated
What I have so far:
import requests
from bs4 import BeautifulSoup
URL = 'https://www.banggood.com/BlitzWolf-BW-LT32-2M-USB-RGB-TV-Strip-Light-Kit-Sync-with-TV-Screen-Color-3-Sides-Cover-for-TV-Vivid-RGB-Color-Lighting-Effect-and-Dual-Simple-Control-p-1785284.html?akmClientCountry=HU&channel=facebookads&utm_source=facebookads&utm_medium=cpc&utm_campaign=app-dpa-all-ww-sm-afpur180-0407_prdshare_msg&utm_content=suki&utm_design=-&fbclid=IwAR3cAovrze4opttuwwpUxnXZ6dkRjhau3RqmDqASPW0mSEOI8sJgn9Cqss8&_branch_match_id=850392564428961100&cur_warehouse=CN&ID=45764'
headers = {"User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537'}
page = requests.get(URL, headers=headers)
soup = BeautifulSoup(page.content, 'html.parser')
title = soup.find("span",{"class":'product-title-text'}).get_text()
price = soup.find("span",{"class":'main-price'}).get_text()
converted_price = price[0:5]
print(converted_price)
print(title)
Aucun commentaire:
Enregistrer un commentaire