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

Method parse

tests/mongo_spider.py:27–35  ·  view source on GitHub ↗
(self, request, response)

Source from the content-addressed store, hash-verified

25 yield feapder.Request("https://www.baidu.com")
26
27 def parse(self, request, response):
28 title = response.xpath("//title/text()").extract_first() # 取标题
29 for i in range(10):
30 item = Item() # 声明一个item
31 item.table_name = "test_mongo"
32 item.title = title + str(666) # 给item属性赋值
33 item.i = i + 5
34 item.c = "777"
35 yield item # 返回item, item会自动批量入库
36
37
38if __name__ == "__main__":

Callers

nothing calls this directly

Calls 2

ItemClass · 0.90
xpathMethod · 0.80

Tested by

no test coverage detected