之前我们已经说过网页抓取的相关内容
上次我们是以亚马逊某网页的产品为例
抓取价格、品牌、型号、样式等
该网页上价格、品牌、型号、样式等
都只有一个
如果网页上的目标内容
根据不同规格有多个
又该怎么提取呢?
▼如下图所示
当机身颜色、套餐、存储容量等
规格不同时
对应价格也不同
那该怎么获取不同属性下的价格呢?
此时需要用到抓取商品详情信息的API接口item_get、或者item_get_sku。
详细调用步骤如下:
2、进入API测试页,输入商品id,调用API。如下图:
3、找到响应示例中的sku信息
- "skus": {
- "sku": [
- {
- "price": 678,
- "total_price": 0,
- "orginal_price": 678,
- "properties": "1627207:1007902496;5919063:6536025;12304035:1905146457",
- "properties_name": "1627207:1007902496:机身颜色:幻夜黑;5919063:6536025:套餐类型:官方标配 华为nova5i;12304035:1905146457:存储容量:6+128GB",
- "quantity": 200,
- "sku_id": "5142540523707"
- },
- {
- "price": 778,
- "total_price": 0,
- "orginal_price": 778,
- "properties": "1627207:1007902496;5919063:6536025;12304035:1963543205",
- "properties_name": "1627207:1007902496:机身颜色:幻夜黑;5919063:6536025:套餐类型:官方标配 华为nova5i;12304035:1963543205:存储容量:8+128GB",
- "quantity": 200,
- "sku_id": "5142540523708"
- },
- {
- "price": 868,
- "total_price": 0,
- "orginal_price": 868,
- "properties": "1627207:1007902496;5919063:3266779;12304035:1905146457",
- "properties_name": "1627207:1007902496:机身颜色:幻夜黑;5919063:3266779:套餐类型:套餐一 华为nova5por;12304035:1905146457:存储容量:6+128GB",
- "quantity": 0,
- "sku_id": "5141622086982"
- },
- {
- "price": 878,
- "total_price": 0,
- "orginal_price": 878,
- "properties": "1627207:1007902496;5919063:3266779;12304035:1963543205",
- "properties_name": "1627207:1007902496:机身颜色:幻夜黑;5919063:3266779:套餐类型:套餐一 华为nova5por;12304035:1963543205:存储容量:8+128GB",
- "quantity": 200,
- "sku_id": "5141622086983"
- },
- {
- "price": 678,
- "total_price": 0,
- "orginal_price": 678,
- "properties": "1627207:2771458827;5919063:6536025;12304035:1905146457",
- "properties_name": "1627207:2771458827:机身颜色:苏音蓝;5919063:6536025:套餐类型:官方标配 华为nova5i;12304035:1905146457:存储容量:6+128GB",
- "quantity": 200,
- "sku_id": "5142540523709"
- },
- {
- "price": 778,
- "total_price": 0,
- "orginal_price": 778,
- "properties": "1627207:2771458827;5919063:6536025;12304035:1963543205",
- "properties_name": "1627207:2771458827:机身颜色:苏音蓝;5919063:6536025:套餐类型:官方标配 华为nova5i;12304035:1963543205:存储容量:8+128GB",
- "quantity": 200,
- "sku_id": "5142540523710"
- },
- {
- "price": 868,
- "total_price": 0,
- "orginal_price": 868,
- "properties": "1627207:2771458827;5919063:3266779;12304035:1905146457",
- "properties_name": "1627207:2771458827:机身颜色:苏音蓝;5919063:3266779:套餐类型:套餐一 华为nova5por;12304035:1905146457:存储容量:6+128GB",
- "quantity": 0,
- "sku_id": "5141622086986"
- },
- {
- "price": 878,
- "total_price": 0,
- "orginal_price": 878,
- "properties": "1627207:2771458827;5919063:3266779;12304035:1963543205",
- "properties_name": "1627207:2771458827:机身颜色:苏音蓝;5919063:3266779:套餐类型:套餐一 华为nova5por;12304035:1963543205:存储容量:8+128GB",
- "quantity": 200,
- "sku_id": "5141622086987"
- },
- {
- "price": 678,
- "total_price": 0,
- "orginal_price": 678,
- "properties": "1627207:1198972384;5919063:6536025;12304035:1905146457",
- "properties_name": "1627207:1198972384:机身颜色:蜜语红;5919063:6536025:套餐类型:官方标配 华为nova5i;12304035:1905146457:存储容量:6+128GB",
- "quantity": 200,
- "sku_id": "5142540523705"
- },
- {
- "price": 778,
- "total_price": 0,
- "orginal_price": 778,
- "properties": "1627207:1198972384;5919063:6536025;12304035:1963543205",
- "properties_name": "1627207:1198972384:机身颜色:蜜语红;5919063:6536025:套餐类型:官方标配 华为nova5i;12304035:1963543205:存储容量:8+128GB",
- "quantity": 200,
- "sku_id": "5142540523706"
- },
- {
- "price": 868,
- "total_price": 0,
- "orginal_price": 868,
- "properties": "1627207:1198972384;5919063:3266779;12304035:1905146457",
- "properties_name": "1627207:1198972384:机身颜色:蜜语红;5919063:3266779:套餐类型:套餐一 华为nova5por;12304035:1905146457:存储容量:6+128GB",
- "quantity": 0,
- "sku_id": "5141622086984"
- },
- {
- "price": 878,
- "total_price": 0,
- "orginal_price": 878,
- "properties": "1627207:1198972384;5919063:3266779;12304035:1963543205",
- "properties_name": "1627207:1198972384:机身颜色:蜜语红;5919063:3266779:套餐类型:套餐一 华为nova5por;12304035:1963543205:存储容量:8+128GB",
- "quantity": 200,
- "sku_id": "5141622086985"
- },
- {
- "price": 678,
- "total_price": 0,
- "orginal_price": 678,
- "properties": "1627207:5860482491;5919063:6536025;12304035:1905146457",
- "properties_name": "1627207:5860482491:机身颜色:烟雨青蓝;5919063:6536025:套餐类型:官方标配 华为nova5i;12304035:1905146457:存储容量:6+128GB",
- "quantity": 200,
- "sku_id": "5142540523711"
- },
- {
- "price": 778,
- "total_price": 0,
- "orginal_price": 778,
- "properties": "1627207:5860482491;5919063:6536025;12304035:1963543205",
- "properties_name": "1627207:5860482491:机身颜色:烟雨青蓝;5919063:6536025:套餐类型:官方标配 华为nova5i;12304035:1963543205:存储容量:8+128GB",
- "quantity": 200,
- "sku_id": "5142540523712"
- },
- {
- "price": 868,
- "total_price": 0,
- "orginal_price": 868,
- "properties": "1627207:5860482491;5919063:3266779;12304035:1905146457",
- "properties_name": "1627207:5860482491:机身颜色:烟雨青蓝;5919063:3266779:套餐类型:套餐一 华为nova5por;12304035:1905146457:存储容量:6+128GB",
- "quantity": 0,
- "sku_id": "5141622086988"
- },
- {
- "price": 878,
- "total_price": 0,
- "orginal_price": 878,
- "properties": "1627207:5860482491;5919063:3266779;12304035:1963543205",
- "properties_name": "1627207:5860482491:机身颜色:烟雨青蓝;5919063:3266779:套餐类型:套餐一 华为nova5por;12304035:1963543205:存储容量:8+128GB",
- "quantity": 200,
- "sku_id": "5141622086989"
- }
- ]
- },