:param sku_id :return 商品信息
(self, sku_id)
| 192 | ############## 商品方法 ############# |
| 193 | # 获取商品详情信息 |
| 194 | def _get_item_detail(self, sku_id): |
| 195 | ''' |
| 196 | :param sku_id |
| 197 | :return 商品信息 |
| 198 | ''' |
| 199 | url = 'https://item.jd.com/{}.html'.format(sku_id) |
| 200 | page = requests.get(url=url, headers=self.headers) |
| 201 | |
| 202 | html = etree.HTML(page.text) |
| 203 | vender = html.xpath('//div[@class="follow J-follow-shop"]/@data-vid')[0] |
| 204 | cat = html.xpath('//a[@clstag="shangpin|keycount|product|mbNav-3"]/@href')[0].replace('//list.jd.com/list.html?cat=','') |
| 205 | |
| 206 | detail = dict(cat_id=cat,vender_id=vender) |
| 207 | return detail |
| 208 | |
| 209 | ############## 库存方法 ############# |
| 210 | # 获取单个商品库存状态 |
no test coverage detected