一种通用数据采集的schema定义形式

{
  "name": "凤凰金融",
  "notice": {
    "data": "attribute",
    "matcher": [
      {
        "match": "xpath",
        "pattern": "//*[@id=\"page-financing\"]/div[1]/div[5]/div/div/div[3]"
      }
    ],  "comments": "网站通告"  },
  "url": {
    "data": "attribute",
    "value": "http://www.fengjr.com/financing/list?type=cx"    "comments": "本平台数据的采集URL"  },
  "project": {
    "data": "url",
    "url": {
      "data": "attribute",
      "matcher": [
        {
          "match": "xpath",
          "pattern": "//*[@id=\"page-financing\"]/div[1]/div[5]/div/div/div[3]"
        }
      ],
      "template": ""
    },
    "title": {
      "data": "attribute",
      "matcher": [
        {
          "match": "xpath",
          "pattern": "//*[@id=\"page-financing\"]/div[1]/div[5]/div/div/div[3]"
        }
      ]
    },
    "detail": {
      "title": {
        "data": "attribute",
        "matcher": [
          {
            "match": "xpath",
            "pattern": "//*[@id=\"page-financing\"]/div[1]/div[5]/div/div/div[3]"
          }
        ]
      },
      "amount": {
        "data": "attribute",
        "matcher": [
          {
            "match": "xpath",
            "pattern": "//*[@id=\"page-financing\"]/div[1]/div[5]/div/div/div[3]"
          }
        ]
      }
    }
  },
  "member": {
    "data": "sub_item",
    "sub_item": {
      "matcher": [
        {
          "match": "xpath",
          "pattern": "//*[@id=\"page-financing\"]/div[1]/div[5]/div/div/div[3]"
        }
      ],
      "src-save": 0,
      "url": {
        "matcher": [
          {
            "match": "xpath",
            "pattern": "//*[@id=\"page-financing\"]/div[1]/div[5]/div/div/div[3]"
          }
        ],
        "template": ""
      }
    },
    "detail": {
      "title": {
        "data": "attribute",
        "matcher": [
          {
            "match": "xpath",
            "pattern": "//*[@id=\"page-financing\"]/div[1]/div[5]/div/div/div[3]"
          }
        ]
      },
      "amount": {
        "data": "attribute",
        "matcher": [
          {
            "match": "xpath",
            "pattern": "//*[@id=\"page-financing\"]/div[1]/div[5]/div/div/div[3]"
          }
        ]
      }
    }
  },
  "src-save": 1
}

补充:

{
  "name": "凤凰金融",
  "notice": {
    "data": "attribute",
    "matcher": [
      {
        "match": "xpath",
        "pattern": "//*[@id=\"page-financing\"]/div[1]/div[5]/div/div/div[3]"
      }
    ]
  },
  "url": {
    "data": "attribute",
    "value": "http://www.fengjr.com/financing/list?type=cx"
  },
  "project": {
    "data": "url",
    "url": {
      "data": "attribute",
      "matcher": [
        {
          "match": "xpath",
          "pattern": "//*[@id=\"page-financing\"]/div[1]/div[5]/div/div/div[3]"
        }
      ],
      "template": ""
    },
    "title": {
      "data": "attribute",
      "matcher": [
        {
          "match": "xpath",
          "pattern": "//*[@id=\"page-financing\"]/div[1]/div[5]/div/div/div[3]"
        }
      ]
    },
    "detail": {
      "name": "网贷列表",
      "title": {
        "data": "attribute",
        "matcher": [
          {
            "match": "xpath",
            "pattern": "//*[@id=\"page-financing\"]/div[1]/div[5]/div/div/div[3]"
          }
        ]
      },
      "amount": {
        "data": "attribute",
        "matcher": [
          {
            "match": "xpath",
            "pattern": "//*[@id=\"page-financing\"]/div[1]/div[5]/div/div/div[3]"
          }
        ]
      }
    }
  },
  "member": {
    "data": "sub_item",
    "sub_item": {
      "matcher": [
        {
          "match": "xpath",
          "pattern": "//*[@id=\"page-financing\"]/div[1]/div[5]/div/div/div[3]"
        }
      ],
      "src-save": 0,
      "url": {
        "data": "attribute",
        "matcher": [
          {
            "match": "xpath",
            "pattern": "//*[@id=\"page-financing\"]/div[1]/div[5]/div/div/div[3]"
          }
        ],
        "template": ""
      }
    },
    "detail": {
      "name": "会员材料",
      "title": {
        "data": "attribute",
        "matcher": [
          {
            "match": "xpath",
            "pattern": "//*[@id=\"page-financing\"]/div[1]/div[5]/div/div/div[3]"
          }
        ]
      },
      "amount": {
        "data": "attribute",
        "matcher": [
          {
            "match": "xpath",
            "pattern": "//*[@id=\"page-financing\"]/div[1]/div[5]/div/div/div[3]"
          }
        ]
      }
    }
  },
  "src-save": 1,

  "crawler": {

      "handler":"httpClient|selenium",
      "results":"html|json|text",
      "next_page": {
        "matcher": [
          {
            "match": "xpath",
            "pattern": "//*[@id=\"page-financing\"]/div[1]/div[5]/div/div/div[3]"
          }
         ],
        "template": ""
      },
      "history": "re-crawl|skip|stop"
    }

}
时间: 2024-07-29 11:15:08

一种通用数据采集的schema定义形式的相关文章

一种通用查询语言的定义与实践

最近发现在项目中或许会遇到让用户自己构建查询表达式的情况.比如需要通过一种可配置的界面,来让用户输入一组具有逻辑关系的查询表达式,然后根据这个查询表达式来过滤并返回所需要的数据.这种用户案例其实非常常见.由此受到启发,或许我们可以自己定义一种通用的面向查询的领域特定语言(DSL),来实现查询的序列化和动态构建. 概述 由此我发布了一个称为Unified Queries(以下简称UQ)的开源项目,UQ定义了一种DSL,用以描述一种查询的特定结构.它同时还提供了将查询规约(Query Specifi

一种通用的树形二进制协议描述方法与处理算法

概述: 本方法定义了一种数据结构,可用于描述任意的树形二进制协议,并配合一个特定的处理算法,可实现一种通用的,由该种树形二进制协议定义的比特流解析与填充的处理,该数据结构的定义如下: /* 以下结构用于定义一个协议节点的描述信息. */ struct _proto_info; typedef struct _proto_des { const char *              name; /* 用于描述一个协议节点的名称. */ size_t                    stat

a=10,b=6,将其值互换。(至少3种方法,尝试不定义第3个变量)

互换两个变量值.(至少3种方法,尝试不定义第3个变量) 废话不多说直接上代码 package com.admxj.swap; /*  * 2015年12月7日23:49:20  * Java可避免C语言的溢出错误  * 方法四可能会出现溢出情况  */ public class Day01 { public static void main(String[] args) { int[] arr = {-2147483449,2147483420}; System.out.println("源数据

ASIC设计中一种通用型并行设计方法

我是个"低调"的人,总不喜欢表达出来,对异性如此,对工作也是如此.在翔哥的鼓励下,决定把自己工作的一些经验和思考写下来,和同道们一起分享. ASIC设计中一种通用型并行设计方法: 1)流水网的概念提出 IC设计中的控制有串行和并行两种思想.状态机方法反应了串行控制思想,有软件的思路,比较好理解,新手比较喜欢用.流水线方法是并行处理的思想,比较抽象,因为其效率高,老手喜欢用.从"流水线"的名字就容易知道,它只是一维的一条线,一个设计中可以有很多条.小设计中可能很容易设

一种通用的网页相似度检测算法

如果我们需要在海量的结构未知的网页库中找到和指定的网页相似度比较高的一些网页,我们该怎么办呢?本文提出的"一种通用的网页相似度检测算法"就是专门解决这个问题. 算法如下: 1.提取网页文本.这个提取步骤不要求精确,也没办法精确,因为你面对的是未知结构的网页,所以只需要提取去掉标签之后的文本即可. 2.对提取的文本进行分词.我们使用开源的中文分词组件word分词. 3.为每一个网页建立一个词向量,向量的维度就是两个网页的不重复词的并集,每一个维度的权重就是词频TF,我们这里忽略IDF也不

javascript中字符串的两种定义形式

1.var s = "this is a string";  var t = "this is also a string"; s.test = 20; 2.var s = new String("this is a string"); var t = new String("this is also a string");  s.test = 20; 这两种方式有何区别? 第一种方式定义的test为s.t以及将来的所用此种形

js函数的两种定义形式,函数的实参列表arguments/形参列表函数名

1.声明式函数:function test(){}; 2.表达式函数:var test=function(){} 例:function test(a,b){} test(2,3,4) ->函数的形参和实参是可变的 函数内参数参数列表: 1.实参列表:在函数内用arguments表示,如上例:arguments=[2,3,4] 2.在函数内test.length表示形参列表长度 原文地址:https://www.cnblogs.com/fangming/p/8847650.html

使用工厂bean和Utility Schema定义集合

工厂bean是实现了beanFactory接口的bean,也可以继承AbstractFactoryBean,主要是用于在给定属性参数之后自动创建一个bean对象. 我们在使用基本集合标记定义集合时,不能够指定集合的实体类,例如LinkedList.TreeSet或TreeMap等,而且也不能通过将集合定义为可供其他bean引用的单独bean在不同放入bean中共享集合. Spring提供了两种选项来提供基本集合标记的不足. 选项之一使用对应的集合工厂bean:ListFactoryBean.Se

css样式优化 设置一种通用的class类

这里,我说的是“通常情况下”,因为其他测试引擎可能对容器和测试有截然不同的定义.但一般情况下,测试就是单个的方法,容器指的就是测试类. 有人说拖延症是一个绝症,哎呀治不好了.先不说这是一个每个人都多多少少会有的,也不管它究竟对生活有多么大的影响,单单是自己的念想受到了一定得局限,想法不能够像平地而起的高楼大厦建成一样.可是那大楼也是有烂尾的呀,我觉得最重要的还是外在环境与个人观念的先决条件,决定了拖延症的症状的好坏,有那么一些人,它也有拖延症,但是它在拖的中间,想的更多,看的更远.事情在做的时候