You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
1.0 KiB

1 week ago
import requests
from bs4 import BeautifulSoup
# 海尔2匹
r = requests.get(
'https://www.haier.com/igs/front/cn_product/getProduct?code=3e6bff6304c547dba650d9941aa472c0&searchWord=(filter.bgskd_filter_jsqjkm4d%3D2869)+and+(filter.bgskd_filter_ezhn4ow6%3D1265)+and+(channelId%3D38359)+and+(psale%3D0)&pageNo=1&pageSize=32&siteId=2&aggs=&filterJsonUrl=https%3A%2F%2Fwww.haier.com%2Fcn%2Fair_conditioners%2Ffilter_es.json&orderBy=saleFlag%3Adesc%2CproductSaleDate%3Adesc&filter=1265%2C2869&defaultSearch=(channelId%3D38359)+and+(psale%3D0)&retFilterJson=yes')
print(r.json()['page']['data'])
# 格力2匹
d = {
'page': 1,
'brandId': '',
'attrId': '',
'attributes': '10:631815;11:631819;15:631825;',
'keyword': '',
'cid': '852',
'orderSort': '0',
'payType': '',
}
r = requests.post('https://mall.gree.com/goods/search/searchItem', data=d)
detail_url = 'http://mall.gree.com'
# print(r.text)
soup = BeautifulSoup(r.text, 'lxml')
ss = soup.find_all(attrs={'class': 'Product_box'})
for s in ss:
print(s.prettify())
print(s.a())