主要代码:

 Gecco(matchUrl="https://github.com/{user}/{project}", pipelines="consolePipeline")
public class MyGithub implements HtmlBean { private static final long serialVersionUID = -7127412585200687225L; @Request
private HttpRequest request; @RequestParameter("user")
private String user; @RequestParameter("project")
private String project; @Text
@HtmlField(cssPath=".repository-meta-content")
private String title; @Text
@HtmlField(cssPath=".pagehead-actions li:nth-child(2) .social-count")
private int star; @Text
@HtmlField(cssPath=".pagehead-actions li:nth-child(3) .social-count")
private int fork; @Href(click=false)
@HtmlField(cssPath="ul.numbers-summary > li:nth-child(4) > a")
private String contributors; @HtmlField(cssPath=".entry-content")
private String readme; public HttpRequest getRequest() {
return request;
} public void setRequest(HttpRequest request) {
this.request = request;
} public String getReadme() {
return readme;
} public void setReadme(String readme) {
this.readme = readme;
} public String getUser() {
return user;
} public void setUser(String user) {
this.user = user;
} public String getProject() {
return project;
} public void setProject(String project) {
this.project = project;
} public String getTitle() {
return title;
} public void setTitle(String title) {
this.title = title;
} public int getStar() {
return star;
} public void setStar(int star) {
this.star = star;
} public int getFork() {
return fork;
} public void setFork(int fork) {
this.fork = fork;
} public String getContributors() {
return contributors;
} public void setContributors(String contributors) {
this.contributors = contributors;
} public static void main(String[] args) {
GeccoEngine.create()
.classpath("com.geccocrawler.gecco.demo")
//开始抓取的页面地址
.start("https://github.com/xtuhcy/gecco")
//开启几个爬虫线程,线程数量最好不要大于start request数量
.thread(2)
//单个爬虫每次抓取完一个请求后的间隔时间
.interval(2000)
.run();
} }

JAVA 爬虫Gecco的更多相关文章

  1. Java爬虫——Gecco简单入门程序(根据下一页一直爬数据)

    为了完成作业,所以学习了一下爬虫Gecco,这个爬虫集合了以往所有的爬虫的特点,但是官方教程中关于Gecco的教程介绍的过于简单,本篇博客是根据原博客的地址修改的,原博客中只有程序的截图,而没有给出一 ...

  2. 教您使用java爬虫gecco抓取JD全部商品信息

    gecco爬虫 如果对gecco还没有了解可以参看一下gecco的github首页.gecco爬虫十分的简单易用,JD全部商品信息的抓取9个类就能搞定. JD网站的分析 要抓取JD网站的全部商品信息, ...

  3. 使用轻量级JAVA 爬虫Gecco工具抓取新闻DEMO

    写在前面 最近看到Gecoo爬虫工具,感觉比较简单好用,所有写个DEMO测试一下,抓取网站 http://zj.zjol.com.cn/home.html,主要抓取新闻的标题和发布时间做为抓取测试对象 ...

  4. JAVA使用Gecco爬虫 抓取网页内容(附Demo)

    JAVA 爬虫工具有挺多的,但是Gecco是一个挺轻量方便的工具. 先上项目结构图. 这是一个 JAVASE的 MAVEN 项目,要添加包依赖,其他就四个文件.log4j.properties 加上三 ...

  5. Java 爬虫学习

    Java爬虫领域最强大的框架是JSoup:可直接解析具体的URL地址(即解析对应的HTML),提供了一套强大的API,包括可以通过DOM.CSS选择器,即类似jQuery方式来取出和操作数据.主要功能 ...

  6. Java爬虫框架调研

    Python中大的爬虫框架有scrapy(风格类似django),pyspider(国产python爬虫框架). 除了Python,Java中也有许多爬虫框架. nutch apache下的开源爬虫程 ...

  7. webmagic的设计机制及原理-如何开发一个Java爬虫

    之前就有网友在博客里留言,觉得webmagic的实现比较有意思,想要借此研究一下爬虫.最近终于集中精力,花了三天时间,终于写完了这篇文章.之前垂直爬虫写了一年多,webmagic框架写了一个多月,这方 ...

  8. JAVA爬虫挖取CSDN博客文章

    开门见山,看看这个教程的主要任务,就去csdn博客,挖取技术文章,我以<第一行代码–安卓>的作者为例,将他在csdn发表的额博客信息都挖取出来.因为郭神是我在大学期间比较崇拜的对象之一.他 ...

  9. 爬虫6:多页面增量Java爬虫-sina主页

    之前写过很多单页面python爬虫,感觉python还是很好用的,这里用java总结一个多页面的爬虫,迭代爬取种子页面的所有链接的页面,全部保存在tmp路径下. 1 序言 实现这个爬虫需要两个数据结构 ...

随机推荐

  1. JetBrains 系列软件汉化包

    原文地址:https://blog.csdn.net/pingfangx/article/details/78826145 JetBrains 系列软件汉化包 关键字: Android Studio ...

  2. c# 四舍五入、上取整、下取整

    在处理一些数据时,我们希望能用“四舍五入”法实现,但是C#采用的是“四舍六入五成双”的方法,如下面的例子,就是用“四舍六入五成双”得到的结果: double d1 = Math.Round(1.25, ...

  3. 在Win7环境下安装启动Linux

    在Win7环境下安装启动Linux 在Win7系统下,安装启动Linux特别的不方便,由于XP下的boot.ini配置文件不在了,要加入�一下启动选项的话, 仅仅能使用专门的工具,这或多或少给人带来不 ...

  4. warning,C4996,sprintf,deprecated,C4996,strcpy,C4996,strcat

    在vs2003, vs2005中用sprintf 会出现warning C4996: 'sprintf' was declared deprecated或warning C4996: 'strcpy' ...

  5. Android Activity的四种LaunchMode!!!

    本文转自: http://marshal.easymorse.com/archives/2950. 写的非常好,分享给大家!!! 在多Activity开发中,有可能是自己应用之间的Activity跳转 ...

  6. 关于DirectShow SDK 和Windows SDK,及DirectX SDK

    关于DirectShow SDK 和Windows SDK,及DirectX SDK   本文描述了DirectShow SDK ,Windows SDK,DirectX SDK ,VS200?之间的 ...

  7. tinyxml使用笔记与总结

    在TinyXML中,根据XML的各种元素来定义了一些类:        TiXmlBase:整个TinyXML模型的基类.        TiXmlAttribute:对应于XML中的元素的属性.   ...

  8. [翻译] RBBAnimation,让你使用关键帧动画更便利

    RBBAnimation RBBAnimation is a subclass of CAKeyframeAnimation that allows you to declare your anima ...

  9. [翻译] LASIImageView - 显示进度指示并异步下载图片

      LASIImageView – download image with progress indicator 翻译原网址:http://lukagabric.com/lasiimageview-d ...

  10. java静态初始化数据

    1.通过静态成员变量和静态方法组合(比较单一) public class A{ private static String t=getInit(); private static String get ...