python 爬虫实战(三)使用pyspider爬取虎嗅新闻
2018-03-12 15:29
561 查看
#!/usr/bin/env python # -*- encoding: utf-8 -*- # Created on 2018-03-02 23:14:26 # Project: huxiu from pyspider.libs.base_handler import * class Handler(BaseHandler): crawl_config = { } @every(minutes=24 * 60) def on_start(self): self.crawl('https://www.huxiu.com/channel/105.html', callback=self.index_page,validate_cert=False) @config(age=10 * 24 * 60 * 60) def index_page(self, response): for each in response.doc('.mod-b.mod-art.clearfix h2 > a').items(): self.crawl(each.attr.href, callback=self.detail_page,validate_cert=False,fetch_type='js') @config(priority=2) def detail_page(self, response): return { "url": response.url, "title": response.doc('title').text()+' ', "detail":response.doc('.article-content-wrap > p').text() }
相关文章推荐
- python3.4学习笔记(十三) 网络爬虫实例代码,使用pyspider抓取多牛投资吧里面的文章信息,抓取政府网新闻内容
- python 爬虫实战(二)使用pyspider爬取菜谱及图片
- Python爬虫实战一之使用Beautiful Soup抓取百度招聘信息并存储excel文件
- python3[爬虫实战] 使用selenium,xpath爬取京东手机(下)
- Pyspider框架 —— Python爬虫实战之爬取 V2EX 网站帖子
- python3[爬虫实战] 使用selenium,xpath爬取京东手机(上)
- python3[爬虫实战] 使用selenium,xpath爬取京东手机(下)
- python3 [爬虫实战] 微博爬虫京东客服之Selenium + Chrom浏览器的使用(上)
- python3 [爬虫入门实战]爬虫之selenium 安装设置与初步使用
- Python爬虫入门实战七:使用Selenium--以抓取QQ空间好友说说为例
- python网络爬虫实战3——抓取新闻内文相关信息
- Python 爬虫实战(二):使用 requests-html
- Python爬虫实战之使用Scrapy爬起点网的完本小说
- Python 爬虫实战(一):使用 requests 和 BeautifulSoup
- python3[爬虫实战] 使用selenium,xpath爬取京东手机(上)
- Python使用BeautifulSoup爬虫,和pyspider框架的使用
- Windows下Python爬虫框架pyspider的安装与使用
- Python 图片爬虫实战(使用 urllib 库)
- python3 [爬虫入门实战] 爬虫之使用selenium 爬取百度招聘内容并存mongodb