Answer the question
In order to leave comments, you need to log in
How to implement parsing of variable products?
I'm learning parsing. I ran into a problem when parsing variable products, for example, as in the picture
. When you select certain characteristics, the price of the product changes.
How to solve such a problem and what is the best way to upload data, for example, to .csv?
Answer the question
In order to leave comments, you need to log in
Either selenium, or just like in normal parsing, it's no different. We also open the page code and look for the necessary data.
import requests
import json
import re
r = requests.get('https://aliexpress.ru/item/4000985692469.html')
script = json.loads(re.search(r'{"actionModule.+}}', r.text).group())
goods = script['skuModule']['skuPriceList']
for good in goods:
name = good['skuAttr'].split('#')[-1]
price = good['skuVal']['skuActivityAmount']['formatedAmount']
print(name, price)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question