price_search.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:E-commerce-crawlers 作者: Hopetree 项目源码 文件源码
def get_info(self,id):
        '''???????????????????????????????'''
        dic = {}
        url = 'https://detail.tmall.hk/hk/item.htm?spm=a220o.1000855.1998025129.2.102f616emYvWTL&abtest=_AB-LR32-PR32&pvid=a2be15e3-8200-46b3-bd09-de041b8b8dc3&pos=2&abbucket=_AB-M32_B9&acm=03054.1003.1.2431317&id={}&scm=1007.12144.81309.23864_0&sku_properties=-1:-1'.format(id)
        self.driver.get(url)
        # html = self.driver.page_source
        # print(html)
        try:
            location = self.waiter.until(
                EC.presence_of_element_located((By.XPATH,'//dl[@class="tm-happy11-panel"]/dd/span[@class="tm-price"]'))
            )
            info = location.text.strip()
            dic['id'] = id
            dic['price'] = info if info else '?????'
            self.write_info(dic)
        except TimeoutException as e:
            print(e)
            dic['id'] = id
            dic['price'] = '{}????????'.format(e).strip()
            self.write_info(dic)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号