【发布时间】:2014-04-09 08:48:21
【问题描述】:
我想抓取固定站点的 sitemap.xml 中存在的所有链接。我遇到了 Scrapy 的 SitemapSpider。到目前为止,我已经提取了站点地图中的所有网址。现在我想通过站点地图的每个链接进行爬网。任何帮助都会非常有用。到目前为止的代码是:
class MySpider(SitemapSpider):
name = "xyz"
allowed_domains = ["xyz.nl"]
sitemap_urls = ["http://www.xyz.nl/sitemap.xml"]
def parse(self, response):
print response.url
【问题讨论】:
-
如果您可以为该域发布一个有效的url,那么检查代码会更容易
标签: python scrapy web-crawler sitemap