|
@@ -57,6 +57,9 @@ class ApiSpider(scrapy.spiders.Spider):
|
|
#获取类名为book的div中的内容
|
|
#获取类名为book的div中的内容
|
|
_content=response.xpath("//div[@class='book']").xpath('string(.)')
|
|
_content=response.xpath("//div[@class='book']").xpath('string(.)')
|
|
apiItem['content']=_content[0].extract() if _content else ""
|
|
apiItem['content']=_content[0].extract() if _content else ""
|
|
|
|
+ #作者信息
|
|
|
|
+ _author=response.xpath("//pre[@class='authors']").xpath('string(.)')
|
|
|
|
+ apiItem['author']=_author[0].extract() if _author else ""
|
|
|
|
|
|
yield apiItem
|
|
yield apiItem
|
|
|
|
|