通过 scrapy 查询时网站没有 return table

Website doesnt return table when querying by scrapy

我正在尝试查询 https://www.bankofindia.co.in/Home/BranchLocator?page=1,当我打开网站时,它显示了 table 的数据。并且在页面中向前和向后移动也会显示和更新 table。但是当通过 scrapy 查询时, table 没有被返回。

    start_urls = [
    "https://www.bankofindia.co.in/Home/BranchLocator?page={}".format(i)
    for i in range(1, 10)
]

def parse(self, response, **kwargs):
    """Parse response."""
    all_names = response.xpath(
        "//span[@id='BranchName']/text()",
    ).extract()
    for name in all_names:
        print(name)

    all_addresses = response.xpath(
        "//span[@id='Address']/text()",
    ).extract()

是我做错了什么还是网站运行不正常?

这里没有错。实际上,要获得 table 数据,您必须填写表格,填写的表格将生成 tables,而您必须抓取 table 数据,否则这是不可能的。您看到的带有页码的 table 数据是动态的,即使不是从 xhr api 请求生成的。

PS:您需要填写以下内容:Brunch Name, IFSC Code, State, City