Add sitemapspider auto lastmod to document

This commit is contained in:
FragrantOrchid 2026-08-03 18:20:03 +08:00
parent bf9b25438b
commit fb46b5b7c3
1 changed files with 5 additions and 0 deletions

View File

@ -856,6 +856,11 @@ SitemapSpider
if date_time.year >= 2005:
yield entry
def parse(self, response):
# At the same time, you can get lastmod from meta
item = your_item()
item["lastmod"] = response.meta.get("lastmod")
This would retrieve only ``entries`` modified on 2005 and the following
years.