【问题标题】:Scrapy https tutorialScrapy https 教程
【发布时间】:2017-06-30 16:11:38
【问题描述】:

大家!

我是 Scrapy 框架的新手。我需要解析wisemapping.com。 起初,我阅读了官方的 Scrapy 教程并尝试访问其中一个“wisemap”,但出现错误:

[scrapy.core.engine] DEBUG: Crawled (404) <GET https://app.wisemapping.com/robots.txt> (referer: None)

[scrapy.downloadermiddlewares.retry] DEBUG: Gave up retrying
<GET https://app.wisemapping.com/c/maps/576786/public> (failed 3 times): 500 Internal Server Error

[scrapy.core.engine] DEBUG: Crawled (500) <GET https://app.wisemapping.com/c/maps/576786/public> (referer: None)

[scrapy.spidermiddlewares.httperror] INFO: Ignoring response <500 https://app.wisemapping.com/c/maps/576786/public>: HTTP status code is not handled or not allowed

请给我一个建议,用以下代码解决问题:

import scrapy

class QuotesSpider(scrapy.Spider):
    name = "quotes"

    def start_requests(self):
        urls = [
            'https://app.wisemapping.com/c/maps/576786/public',
        ]
        for url in urls:
            yield scrapy.Request(url=url, callback=self.parse)

    def parse(self, response):
        page = response.url.split("/")[-2]
        filename = 'wisemape.html'
        with open(filename, 'wb') as f:
            f.write(response.body)
        self.log('Saved file %s' % filename)

【问题讨论】:

    标签: python python-3.x web-scraping scrapy


    【解决方案1】:

    导航到https://app.wisemapping.com/c/maps/576786/public 会出现错误 “Outch!!。这张地图已经不可用了。 您没有足够的权限查看此地图。此地图已更改为私人地图或已删除。”

    这张地图存在吗?如果是这样,请尝试将其公开。

    如果您确实知道您尝试访问的地图存在,请验证您尝试访问的 URL 是否正确。

    【讨论】:

      猜你喜欢
      • 2017-01-07
      • 1970-01-01
      • 2014-01-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-01
      • 2014-02-27
      • 2017-05-03
      相关资源
      最近更新 更多