13283339616 6 years ago
parent
commit
dc7999dbb8
2 changed files with 4 additions and 0 deletions
  1. 2 0
      xiaowu/spiders/food.py
  2. 2 0
      xiaowu/spiders/foodEveryday.py

+ 2 - 0
xiaowu/spiders/food.py

@@ -30,6 +30,8 @@ class FoodSpider(scrapy.Spider):
30 30
             linkurl=(quote.xpath("./@href").extract_first())
31 31
             imgsrc=(quote.xpath("./img/@src").extract_first())
32 32
             spantitle=(quote.xpath("./span/text()").extract_first())
33
+            if spantitle is None:
34
+                spantitle=(quote.xpath("./text()").extract_first())
33 35
             if linkurl is not None:
34 36
                 yield scrapy.Request(response.urljoin(linkurl),meta={'linkurl': linkurl,'imgsrc':imgsrc,'filename':filename,'spantitle':spantitle},callback=self.doparse)
35 37
                 # fhtml.write(linkurl+ "\n")

+ 2 - 0
xiaowu/spiders/foodEveryday.py

@@ -27,6 +27,8 @@ class quyaqu(scrapy.Spider):
27 27
             linkurl=(quote.xpath("./@href").extract_first())
28 28
             imgsrc=(quote.xpath("./img/@src").extract_first())
29 29
             spantitle=(quote.xpath("./span/text()").extract_first())
30
+            if spantitle is None:
31
+                spantitle=(quote.xpath("./text()").extract_first())
30 32
             if linkurl is not None:
31 33
                 yield scrapy.Request(response.urljoin(linkurl),meta={'linkurl': linkurl,'imgsrc':imgsrc,'filename':filename,'spantitle':spantitle},callback=self.doparse)
32 34
                 # fhtml.write(linkurl+ "\n")