python - pyspider下无法web预览页面
PHP中文网
PHP中文网 2017-04-17 17:38:28
0
2
732

1 在demo.pyspider.org/debug/sask 建立了任务

2 采集的目标网站为https://sasktenders.ca/Content/Public/Se...

3 问题:web界面下 html可以显示源码,但web预览无法查看,怀疑是ajax问题 已增加fetch_type='js'的选项 但还是显示不出来 求帮助

代码如下:

#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Created on 2016-04-04 15:28:30
# Project: sask

from pyspider.libs.base_handler import *


class Handler(BaseHandler):
    crawl_config = {
    }

    @every(minutes=24 * 60)
    def on_start(self):
        self.crawl('https://sasktenders.ca/Content/Public/Search.aspx',fetch_type='js', callback=self.index_page)

    @config(age=10 * 24 * 60 * 60)
    def index_page(self, response):
        for each in response.doc('a[href^="http"]').items():
            self.crawl(each.attr.href, callback=self.detail_page)

    @config(priority=2)
    def detail_page(self, response):
        return {
            "url": response.url,
            "title": response.doc('title').text(),
        }
PHP中文网
PHP中文网

认证0级讲师

reply all(2)
Ty80

This page is set to <meta http-equiv="X-Frame-Options" content="deny" />
and is not allowed to be displayed on the web page

洪涛

Have you solved this problem? Can you share it? Thank you!

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template