[Solved] Unable to capture records name , price and rating and image in Requests Python [closed]


You have to scrape the adidas site and use regex:

import requests
import re

endpoint = "https://www.adidas.com.au/continental-80-shoes/G27707.html"
headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36'
}
response = requests.get(endpoint, headers = headers)
data = response.text

pricereg = r"(?<=\"price\":)(.*)(?=,\")"
namereg = r"(?<=\"name\":)(.*)(?=,\"co)"
ratingreg= r"(?<=\"ratingValue\":)(.*)(?=,\"reviewCou)"

price = re.search(pricereg, data, re.MULTILINE).group()
name = re.search(namereg, data, re.MULTILINE).group()
rating = re.search(ratingreg, data, re.MULTILINE).group()

print(f"name {name}, rating {rating}, price {price}")

0

solved Unable to capture records name , price and rating and image in Requests Python [closed]