I am trying to get JSON data of products from the website. The code worked for around 400 - 500 products. But it gives "AttributeError: 'NoneType' object has no attribute 'group'" error for this product. I am not good at regular expression. I think the problem occurring because of double quotation. I could not escape from it. I tried (\ ") that one. But it still throws the error. How can I fix it?
Code
import re,json,requests
r = requests.get("https://www.trendyol.com/xiaomi/64mp-note-9-pro-6gb-64gb-6-67-yesil-akilli-cep-telefonu-p-58882069")
data = json.loads(re.search(r'PRODUCT_DETAIL_APP_INITIAL_STATE__=(.*?\}\});', r.text).group(1))
from How to get json data of product detail from website?
No comments:
Post a Comment