MCPcopy Create free account
hub / github.com/Boris-code/feapder / parse

Method parse

tests/jd_spider.py:32–41  ·  view source on GitHub ↗
(self, request, response)

Source from the content-addressed store, hash-verified

30 yield feapder.Request(url, task_id=task_id) # 携带task_id字段
31
32 def parse(self, request, response):
33 title = response.xpath("string(//div[@class='sku-name'])").extract_first(default="").strip()
34
35 item = Item()
36 item.table_name = "jd_item" # 指定入库的表名
37 item.title = title
38 item.batch_date = self.batch_date # 获取批次信息,批次信息框架自己维护
39 item.crawl_time = tools.get_current_date() # 获取当前时间
40 yield item # 自动批量入库
41 yield self.update_task_batch(request.task_id, 1) # 更新任务状态
42
43
44if __name__ == "__main__":

Callers 8

docsify.min.jsFile · 0.45
oFunction · 0.45
mFunction · 0.45
seFunction · 0.45
jeFunction · 0.45
getAllPathsFunction · 0.45
initFunction · 0.45
init$1Function · 0.45

Calls 3

ItemClass · 0.90
xpathMethod · 0.80
update_task_batchMethod · 0.45

Tested by

no test coverage detected