#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Created on 2014-10-31 13:05:52 import re
from libs.base_handler import * class Handler(BaseHandler):
'''
this is a sample handler
'''
crawl_config = {
"headers": {
"User-Agent": "BaiDu_Spider",
},
"timeout":300,
"connect_timeout":100
} def on_start(self): self.crawl('http://www.sciencedirect.com/science/journal/02615177',timeout=300,connect_timeout=100,age=0, callback=self.index_page) @config(fetch_type="js")
def index_page(self, response):
for each in response.doc('a').items():
url=each.attr.href
#print(url)
if url!=None:
if re.match('http://www.sciencedirect.com/science/article/pii/\w+$', url):
self.crawl(url,callback=self.detail_page,timeout=300,connect_timeout=100)
self.crawl(response.doc('#volumeIssueData ul.navigation li a.ActionButton').attr.href, callback=self.index_page,timeout=300,connect_timeout=100) @config(fetch_type="js")
def detail_page(self, response):
#self.index_page(response) return {
"url": response.url,
"title": response.doc('h1.article-title span').text(),
"authors": [x.text() for x in response.doc('.author.size-m.workspace-trigger span.content span.text').items()],
"abstract": response.doc('.Abstracts div div p').text(),
"keywords": [x.text() for x in response.doc('.keyword span').items()],
          #这里可以根据你想得到的信息自己根据 csspath添加
}

pyspider爬取tourism management 所有文章的标题 作者 摘要 关键词等等所有你想要的信息的更多相关文章

  1. 爬取博主所有文章并保存到本地(.txt版)--python3.6

    闲话: 一位前辈告诉我大学期间要好好维护自己的博客,在博客园发布很好,但是自己最好也保留一个备份. 正好最近在学习python,刚刚从py2转到py3,还有点不是很习惯,正想着多练习,于是萌生了这个想 ...

  2. 爬虫实战——Scrapy爬取伯乐在线所有文章

    Scrapy简单介绍及爬取伯乐在线所有文章 一.简说安装相关环境及依赖包 1.安装Python(2或3都行,我这里用的是3) 2.虚拟环境搭建: 依赖包:virtualenv,virtualenvwr ...

  3. Node爬取简书首页文章

    Node爬取简书首页文章 博主刚学node,打算写个爬虫练练手,这次的爬虫目标是简书的首页文章 流程分析 使用superagent发送http请求到服务端,获取HTML文本 用cheerio解析获得的 ...

  4. 使用Python爬取微信公众号文章并保存为PDF文件(解决图片不显示的问题)

    前言 第一次写博客,主要内容是爬取微信公众号的文章,将文章以PDF格式保存在本地. 爬取微信公众号文章(使用wechatsogou) 1.安装 pip install wechatsogou --up ...

  5. 网络字体反爬之pyspider爬取起点中文小说

    前几天跟同事聊到最近在看什么小说,想起之前看过一篇文章说的是网络十大水文,就想把起点上的小说信息爬一下,搞点可视化数据看看.这段时间正在看爬虫框架-pyspider,觉得这种网站用框架还是很方便的,所 ...

  6. Python爬取CSDN博客文章

    0 url :http://blog.csdn.net/youyou1543724847/article/details/52818339Redis一点基础的东西目录 1.基础底层数据结构 2.win ...

  7. python3 爬取搜狗微信的文章

    目标地址:http://weixin.sogou.com/weixin? 这个地址是搜狗微信的文章搜索,可以搜索到微信的文章,而我们目标就是这些文章内容 这个url经过测试,当我们没登陆微信只能看到1 ...

  8. Java爬取网络博客文章

    前言 近期本人在某云上购买了个人域名,本想着以后购买与服务器搭建自己的个人网站,由于需要筹备的太多,暂时先搁置了,想着先借用GitHub Pages搭建一个静态的站,搭建的过程其实也曲折,主要是域名地 ...

  9. 使用pyspider爬取巨量淘宝MM图片

    具体搭建步骤不再赘述,这里主要使用到了fakeagent,phantomjs和proxy pyspider的爬取相当智能,在不能获取图片的时候会适当的暂停一段时间再试探性的爬取,配合fakeagent ...

随机推荐

  1. P61 实践作业

    网络攻防实验环境搭建 根据链接下载的实验工具包,将其解压 打开VM虚拟机,点击图中红色框,扫描虚拟机 选择文件所在位置 点击下一步,完成.即可 在VM虚拟机设置中把网络适配器修改为桥接模式.如下图 在 ...

  2. day 09

    内存管理 引用计数:垃圾回收机制的依据 当变量的值被引用的时,变量值的引用计数+1,当变量名被解除绑定时该值的引用计数减少一. 当引用计数变成0的时候会被垃圾回收机制回收. 引用计数会出现循环引用问题 ...

  3. freeswitch dialplan 基础

    freeswitch dialplan 基础 一.基础概念 dialplan 拨号方案 context 拨号表(块) extension  拨号去向 action  (拨号后执行的)动作 condit ...

  4. Error merging: refusing to merge unrelated histories

    解决方案: git pull git pull origin master git pull origin master --allow-unrelated-histories idea提交git提交 ...

  5. JS-jquery对象和dom对象的属性操作区别

    <label class="">时间1</label> <label class="">时间2</label> ...

  6. pm2管理node

    一般直接npm start起的退出命令行就没了,node后台管理工具pm2目前比较流行. npm install -g pm2 pm2 list pm2 start bin/www --name de ...

  7. IIS发布MVC ASP.NET网站

    发布网站后,发现无法访问,最后在配置文件上添加一段: <system.codedom> <compilers> <compiler language="c#;c ...

  8. sliding window:"Marginalization","Schur complement","First estimate jacobin"

    [1]知行合一2 SLAM中的marginalization 和 Schur complement SLAM的Bundle Adjustment上,随着时间的推移,路标特征点(landmark)和相机 ...

  9. spring 装配机制

    <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w ...

  10. 解决Kettle与Kerberos集成问题

    本文目的:记录Kerberos环境下,通过Kettle将MySQL数据清洗到HDFS过程解决的2个问题,希望对大家有所帮助. Kettle版本:pdi-ce-7.1.0.0-12 1.在Kerbero ...