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(),
}
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!