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(),
}
这个页面设置了
<meta http-equiv="X-Frame-Options" content="deny" />
不允许在 web 页面中显示
请问这个问题你解决了吗?能否分享哈,谢谢!