MCPcopy
hub / github.com/zas023/JdBuyer / _get_item_detail

Method _get_item_detail

JdBuyer.py:194–207  ·  view source on GitHub ↗

:param sku_id :return 商品信息

(self, sku_id)

Source from the content-addressed store, hash-verified

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 # 获取单个商品库存状态

Callers 2

buy_item_in_stockMethod · 0.95
testSession.pyFile · 0.80

Calls 1

getMethod · 0.80

Tested by

no test coverage detected