Golang 网络爬虫框架gocolly/colly 二 jQuery selector
Golang 网络爬虫框架gocolly/colly 二 jQuery selector
colly框架依赖goquery库,goquery将jQuery的语法和特性引入到了go语言中。如果要灵活自如地采集数据,首先要了解jQuery选择器。以下内容是翻译jQuery官方网站
Category: Selectors
Borrowing from CSS 1–3, and then adding its own, jQuery offers a powerful set of tools for matching a set of elements in a document.
To use any of the meta-characters ( such as !"#$%&'()*+,./:;<=>?@[\]^`{|}~ ) as a literal part of a name, it must be escaped with with two backslashes: \\. For example, an element with id="foo.bar", can use the selector $("#foo\\.bar"). The W3C CSS specification contains the complete set of rules regarding valid CSS selectors. Also useful is the blog entry by Mathias Bynens on CSS character escape sequences for identifiers.
类别:选择器
从CSS 1-3借用,然后添加它自己的,jQuery提供了一套强大的工具来匹配文档中的一组元素。要使用任何元字符(如 !"#$%&'()*+,./:;<=>?@[\]^`{|}~ )作为名称的文字部分,例如,一个id =“foo.bar”的元素可以使用选择符$("#foo\\.bar")。W3C CSS规范包含了关于有效的CSS选择器的完整规则。Mathias Bynens的关于标识符CSS字符转义序列的博文也是很有用的。
All Selector (“*”)
Selects all elements.
Also in: Selectors > Basic Filter | Selectors > jQuery Extensions
选择所要元素
:animated Selector
Select all elements that are in the progress of an animation at the time the selector is run.
Also in: Selectors > Attribute
选择所有动画元素
Attribute Contains Prefix Selector [name|=”value”]
Selects elements that have the specified attribute with a value either equal to a given string or starting with that string followed by a hyphen (-).
Also in: Selectors > Attribute
属性包含前缀选择器 [name|=”value”]
选择具有指定属性的元素,其值等于给定的字符串,或者以该字符串开头,后跟连字符( - )。
Attribute Contains Selector [name*=”value”]
Selects elements that have the specified attribute with a value containing a given substring.
Also in: Selectors > Attribute
属性包含选择器 [name*=”value”]
选择具有指定属性的元素,其值包含给定子字符串。
Attribute Contains Word Selector [name~=”value”]
Selects elements that have the specified attribute with a value containing a given word, delimited by spaces.
Also in: Selectors > Attribute
属性包含字选择器[name~=”value”]
选择具有指定属性的元素,其值包含由空格分隔的给定单词。
Attribute Ends With Selector [name$=”value”]
Selects elements that have the specified attribute with a value ending exactly with a given string. The comparison is case sensitive.
Also in: Selectors > Attribute
属性结束选择器[name$=”value”]
选择具有指定属性的元素,其值以给定字符串结尾,精确匹配。比较区分大小写。
Attribute Equals Selector [name=”value”]
Selects elements that have the specified attribute with a value exactly equal to a certain value.
Also in: Selectors > Attribute | Selectors > jQuery Extensions
属性等于选择器[name=”value”]
选择具有指定属性的元素,其值恰好等于给定值。
Attribute Not Equal Selector [name!=”value”]
Select elements that either don’t have the specified attribute, or do have the specified attribute but not with a certain value.
Also in: Selectors > Attribute
属性不等于选择器[name!=”value”]
选择不具有指定属性的元素,或者具有指定属性但不具有特定值的元素。
Attribute Starts With Selector [name^=”value”]
Selects elements that have the specified attribute with a value beginning exactly with a given string.
Also in: Selectors > Form | Selectors > jQuery Extensions
属性以开始选择器[name^=”value”]
选择具有指定属性的元素,其值的开始部分与给定字符串完全一致。
:button Selector
Selects all button elements and elements of type button.
Also in: Selectors > Form | Selectors > jQuery Extensions
按钮选择器
选择所有按钮元素和类型按钮的元素。
:checkbox Selector
Selects all elements of type checkbox.
复选框选择器
选择所有复选框
:checked Selector
Matches all elements that are checked or selected.
Also in: Selectors > Hierarchy
匹配所有选中的元素。
Child Selector (“parent > child”)
Selects all direct child elements specified by “child” of elements specified by “parent”.
选择由“parent”指定元素的所有直接“child”指定子元素。
Class Selector (“.class”)
Selects all elements with the given class.
Also in: Selectors > Content Filter
选择指定类的所有元素。
:contains() Selector
Select all elements that contain the specified text.
Also in: Selectors > Hierarchy
选择包含指定文本的所有元素
Descendant Selector (“ancestor descendant”)
Selects all elements that are descendants of a given ancestor.
后代选择器 (“ancestor descendant”)
选择指定祖先的所有后代元素
:disabled Selector
Selects all elements that are disabled.
选择所有被禁用的元素。
Element Selector (“element”)
Selects all elements with the given tag name.
Also in: Selectors > Content Filter
元素选择器
选择指定标签名的所有元素
:empty Selector
Select all elements that have no children (including text nodes).
空选择器
选择所有没有子项的元素(包括文本节点)
:enabled Selector
Selects all elements that are enabled.
Also in: Selectors > Basic Filter | Selectors > jQuery Extensions
选择所有启用的元素
:eq() Selector
Select the element at index n within the matched set.
Also in: Selectors > Basic Filter | Selectors > jQuery Extensions
选择匹配集中index =n的元素(下标从0开始)。
:even Selector
Selects even elements, zero-indexed. See also odd.
Also in: Selectors > Form | Selectors > jQuery Extensions
选择偶数元素,下标从0开始。
:file Selector
Selects all elements of type file.
Also in: Selectors > Child Filter
选择所有文件类型的元素
:first-child Selector
Selects all elements that are the first child of their parent.
Also in: Selectors > Child Filter
选择所有父节点的第一个孩子元素。
:first-of-type Selector
Selects all elements that are the first among siblings of the same element name.
Also in: Selectors > Basic Filter | Selectors > jQuery Extensions
选择同一元素名称的所有兄弟节点中的第一个元素。
:first Selector
Selects the first matched DOM element.
Also in: Selectors > Basic Filter | Selectors > Form
选择第一个匹配的DOM元素。
:focus Selector
Selects element if it is currently focused.
Also in: Selectors > Basic Filter | Selectors > jQuery Extensions
选择指定元素,当前处于获取焦点状态
:gt() Selector
Select all elements at an index greater than index within the matched set.
Also in: Selectors > Attribute
选择匹配集中所有索引大于指定index值的元素。
Has Attribute Selector [name]
Selects elements that have the specified attribute, with any value.
Also in: Selectors > Content Filter | Selectors > jQuery Extensions
选择具有指定属性的所有元素,可以是任何值。
:has() Selector
Selects elements which contain at least one element that matches the specified selector.
Also in: Selectors > Basic Filter | Selectors > jQuery Extensions
选择指定元素,其包含至少一个元素匹配给定选择器。
:header Selector
Selects all elements that are headers, like h1, h2, h3 and so on.
Also in: Selectors > jQuery Extensions | Selectors > Visibility Filter
选择所有标题元素,例如h1,h2,h3等
:hidden Selector
Selects all elements that are hidden.
选择所有隐藏的元素
ID Selector (“#id”)
Selects a single element with the given id attribute.
Also in: Selectors > Form | Selectors > jQuery Extensions
选择具有给定id属性的单个元素。
:image Selector
Selects all elements of type image.
Also in: Selectors > Form | Selectors > jQuery Extensions
选择所有image类型的元素
:input Selector
Selects all input, textarea, select and button elements.
Also in: Selectors > Basic Filter
选择所有input, textarea, select 和button元素。
:lang() Selector
Selects all elements of the specified language.
Also in: Selectors > Child Filter
选择所有指定语言的元素。
:last-child Selector
Selects all elements that are the last child of their parent.
Also in: Selectors > Child Filter
选择所有父元素的最后一个孩子节点元素。
:last-of-type Selector
Selects all elements that are the last among siblings of the same element name.
Also in: Selectors > Basic Filter | Selectors > jQuery Extensions
选择同一元素名称的所有兄弟节点中的最后一个元素。
:last Selector
Selects the last matched element.
Also in: Selectors > Basic Filter | Selectors > jQuery Extensions
选择最后一个匹配的元素。
:lt() Selector
Select all elements at an index less than index within the matched set.
Also in: Selectors > Attribute
在匹配集中选择所有索引小于给定值的元素。
Multiple Attribute Selector [name=”value”][name2=”value2″]
Matches elements that match all of the specified attribute filters.
多属性选择器
符合所有指定属性过滤器的匹配元素集。
Multiple Selector (“selector1, selector2, selectorN”)
Selects the combined results of all the specified selectors.
Also in: Selectors > Hierarchy
多重选择器
选择所有指定选择器的组合结果。
Next Adjacent Selector (“prev + next”)
Selects all next elements matching “next” that are immediately preceded by a sibling “prev”.
Also in: Selectors > Hierarchy
选择所有下一个匹配“next”的元素,紧接在兄弟“prev”之后。
Next Siblings Selector (“prev ~ siblings”)
Selects all sibling elements that follow after the “prev” element, have the same parent, and match the filtering “siblings” selector.
Also in: Selectors > Basic Filter
选择“prev”元素之后的所有同级元素,具有相同的父级,并匹配筛选“siblings”选择器。
:not() Selector
Selects all elements that do not match the given selector.
Also in: Selectors > Child Filter
选择不匹配给定选择器的所有元素。
:nth-child() Selector
Selects all elements that are the nth-child of their parent.
Also in: Selectors > Child Filter
选择所有父元素的第n个子元素。
:nth-last-child() Selector
Selects all elements that are the nth-child of their parent, counting from the last element to the first.
Also in: Selectors > Child Filter
选择所有父元素的第n个子元素,从后向前计数。
:nth-last-of-type() Selector
Selects all the elements that are the nth-child of their parent in relation to siblings with the same element name, counting from the last element to the first.
Also in: Selectors > Child Filter
选择父元素的具有相同指定元素名称的子元素中第n个元素,按照从后向前的顺序计数。
:nth-of-type() Selector
Selects all elements that are the nth child of their parent in relation to siblings with the same element name.
Also in: Selectors > Basic Filter | Selectors > jQuery Extensions
选择父元素的具有相同指定元素名称的子元素中第n个元素
:odd Selector
Selects odd elements, zero-indexed. See also even.
Also in: Selectors > Child Filter
选择所有奇数元素,下标从0开始。
:only-child Selector
Selects all elements that are the only child of their parent.
Also in: Selectors > Child Filter
选择所有父元素的唯一孩子元素。
:only-of-type Selector
Selects all elements that have no siblings with the same element name.
Also in: Selectors > Content Filter | Selectors > jQuery Extensions
选择没有相同元素名称的兄弟节点的所有元素。
:parent Selector
Select all elements that have at least one child node (either an element or text).
Also in: Selectors > Form | Selectors > jQuery Extensions
选择至少有一个孩子节点(元素或文本)的所有元素
:password Selector
Selects all elements of type password.
Also in: Selectors > Form | Selectors > jQuery Extensions
选择所有password类型的元素。
:radio Selector
Selects all elements of type radio.
Also in: Selectors > Form | Selectors > jQuery Extensions
选择所有radio类型的元素。
:reset Selector
Selects all elements of type reset.
Also in: Selectors > Basic Filter
选择所有reset类型的元素
:root Selector
Selects the element that is the root of the document.
Also in: Selectors > Form | Selectors > jQuery Extensions
选择文档的根节点元素。
:selected Selector
Selects all elements that are selected.
Also in: Selectors > Form | Selectors > jQuery Extensions
选择所有选中的元素。
:submit Selector
Selects all elements of type submit.
Also in: Selectors > Basic Filter
选择所有submit类型的元素。
:target Selector
Selects the target element indicated by the fragment identifier of the document’s URI.
Also in: Selectors > Form | Selectors > jQuery Extensions
选择由文档的URI的片段标识符指示的目标元素。
:text Selector
Selects all input elements of type text.
Also in: Selectors > jQuery Extensions | Selectors > Visibility Filter
选择所有text类型的input元素
:visible Selector
Selects all elements that are visible.
选择所有可见元素。
Golang 网络爬虫框架gocolly/colly 二 jQuery selector的更多相关文章
- Golang 网络爬虫框架gocolly/colly 三
Golang 网络爬虫框架gocolly/colly 三 熟悉了<Golang 网络爬虫框架gocolly/colly一>和<Golang 网络爬虫框架gocolly/colly二& ...
- Golang 网络爬虫框架gocolly/colly 四
Golang 网络爬虫框架gocolly/colly 四 爬虫靠演技,表演得越像浏览器,抓取数据越容易,这是我多年爬虫经验的感悟.回顾下个人的爬虫经历,共分三个阶段:第一阶段,09年左右开始接触爬虫, ...
- Golang 网络爬虫框架gocolly/colly 一
Golang 网络爬虫框架gocolly/colly 一 gocolly是用go实现的网络爬虫框架,目前在github上具有3400+星,名列go版爬虫程序榜首.gocolly快速优雅,在单核上每秒可 ...
- Golang 网络爬虫框架gocolly/colly 五 获取动态数据
Golang 网络爬虫框架gocolly/colly 五 获取动态数据 gcocolly+goquery可以非常好地抓取HTML页面中的数据,但碰到页面是由Javascript动态生成时,用goque ...
- 试验一下Golang 网络爬虫框架gocolly/colly
参考:http://www.cnblogs.com/majianguo/p/8186429.html 框架源码在 github.com/gocolly/colly 代码如下(github源码中的dem ...
- 网络爬虫框架Scrapy简介
作者: 黄进(QQ:7149101) 一. 网络爬虫 网络爬虫(又被称为网页蜘蛛,网络机器人),是一种按照一定的规则,自动地抓取万维网信息的程序或者脚本:它是一个自动提取网页的程序,它为搜索引擎从万维 ...
- scrapy爬虫框架教程(二)-- 爬取豆瓣电影TOP250
scrapy爬虫框架教程(二)-- 爬取豆瓣电影TOP250 前言 经过上一篇教程我们已经大致了解了Scrapy的基本情况,并写了一个简单的小demo.这次我会以爬取豆瓣电影TOP250为例进一步为大 ...
- 基于java的网络爬虫框架(实现京东数据的爬取,并将插入数据库)
原文地址http://blog.csdn.net/qy20115549/article/details/52203722 本文为原创博客,仅供技术学习使用.未经允许,禁止将其复制下来上传到百度文库等平 ...
- [原创]一款基于Reactor线程模型的java网络爬虫框架
AJSprider 概述 AJSprider是笔者基于Reactor线程模式+Jsoup+HttpClient封装的一款轻量级java多线程网络爬虫框架,简单上手,小白也能玩爬虫, 使用本框架,只需要 ...
随机推荐
- Numpy入门 - 数组切片操作
本节主要演示数组的切片操作,数组的切片操作有两种形式:更改原数组的切片操作和不更改原数组的切片操作. 一.更改原数组的切片操作 import numpy as np arr = np.array([1 ...
- codeblocks+mbedtls库配置
网上都没有找到window下mbedtls的相关配置,或许是太简单了.希望可以帮助那些像我这样的小白一枚. 下载 github的下载:https://github.com/ARMmbed/mbedtl ...
- NOI导刊2010提高装备运输
www.luogu.org/problem/show?pid=1794 挺裸的一题背包,算很基础. 可以运用的技巧是三维->二维(节省空间还能少敲一点代码 #include<iostrea ...
- SFTP工具类 操作服务器
package com.leadbank.oprPlatform.util;import com.jcraft.jsch.*;import com.jcraft.jsch.ChannelSftp.Ls ...
- 我这样减少了26.5M Java内存!
WeTest 导读 历时五天的内存优化已经结束,这里总结一下这几天都做了什么,有哪些收获.优化了,或可以优化的地方都有哪些.(因为很多事还没做,有些结论需要一定样本量才能断定,所以叫一期)一期优化减少 ...
- 自己定义定时器(Timer)
近期做项目的时候,用到了java.util.Timer定时器类.也初步使用了,个人感觉不错.只是,在某些方面Timer类无法满足项目的需求.比方,在使用Timer时,调用schedule()方法之后( ...
- CI环境配置
CI:php的MVC框架M(模型model):与数据库打交道的,一般情况下数据库里面的一张表对应一个Model,在里面对应该表的增删改查的操作V(视图view):用户看到的界面,其中很多数据是从数据库 ...
- jsp页面制作弹出框
各种弹出页面的设计 [1.普通的弹出窗口] 其实代码非常简单: <SCRIPT LANGUAGE=javascript> <!-- window.open ('page.html') ...
- 自学Zabbix3.2-配置功能简介
zabbix配置功能介绍 zabbix配置内容比较多,我们要分为9大块来讲解.分别如下: 1. 主机与组 添加主机配置与组配置. 1.1.创建主机方法 1.1.1 新建主机 c ...
- Spring:Bean生命周期
关于Bean生命周期,我在网上找了两张图: 图1: 图2: 总结起来就是: Bean构建: Bean对象创建 > @Autowired | @Resource> @PostConstruc ...