首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >刮伤不回我要找的短信

刮伤不回我要找的短信
EN

Stack Overflow用户
提问于 2020-04-23 13:28:42
回答 1查看 38关注 0票数 0

如果我不把这个寄到这里的话.但我们开始了。只是想尝试一些新的东西,并尝试和标题的产品和价格从这个网站。需要一些帮助,为什么我得到多个标题名称,为什么我不能得到的价格为我工作。

代码语言:javascript
运行
复制
# -*- coding: utf-8 -*-
import scrapy


    class SpidervenderSpider(scrapy.Spider):
        name = 'spidervender'
        allowed_domains = ['www.woolworths.com.au/shop/productdetails/306165/red-bull-energy-drink']
        start_urls = ['https://www.woolworths.com.au/shop/productdetails/306165/red-bull-energy-drink']
    
        def parse(self, response):
    
            redbulls = response.xpath('//div')
    
            for redbull in redbulls:
                title = redbull.xpath('.//h1[@class="shelfProductTile-title heading3"]/text()').extract_first()
                price = redbull.xpath('.//shared-price/div/span[@class="price-dollars"]').extract_first()
                if title is not None:
                    print(title)
                print(price)
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61388434

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档