xp 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.markdown +17 -13
- data/pkg/xp-2.0.0.gem +0 -0
- data/xp.gemspec +3 -3
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55c5dd8e1b84dff2af3120f06dfdf8453edda5c1
|
4
|
+
data.tar.gz: b993d48f01ff36a8790c6567bf9c31f7bb6881a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 637fa99efb01d81e53adf76498121b032cdf41fbf835852acd61b69e5d9de8b23e76cf93a32c915b211132db5605c5acef891be58f477a1891518ab042c26395
|
7
|
+
data.tar.gz: 6d6487ca3992ef781d17bcc59f5044d69103c5aa5e8ad457fd9427e48eaa655e6ca73f7de61e3dee44cee958fc286b4cacb9b4d5258aadf28dfc229e69c3d762
|
data/README.markdown
CHANGED
@@ -1,27 +1,31 @@
|
|
1
1
|
## xp
|
2
2
|
|
3
|
-
Ruby gem that adds
|
3
|
+
Ruby gem that adds some methods to String class for intuitive HTML/XML scraping.
|
4
4
|
|
5
5
|
### Installation
|
6
6
|
|
7
|
-
|
7
|
+
``` bash
|
8
|
+
$ gem install xp
|
9
|
+
```
|
8
10
|
|
9
11
|
### Usage
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
-
OR
|
13
|
+
In command line usage, `xp` filters HTML/XML documents provided via STDIN:
|
14
14
|
|
15
|
-
|
15
|
+
``` bash
|
16
|
+
$ curl -s 'https://news.ycombinator.com' | xp --text '//td[class="title"]/a'
|
17
|
+
```
|
16
18
|
|
17
|
-
|
19
|
+
OR
|
18
20
|
|
19
|
-
|
21
|
+
``` bash
|
22
|
+
$ curl -s 'https://news.ycombinator.com' | xp --text 'td.title > a'
|
23
|
+
```
|
20
24
|
|
21
|
-
|
25
|
+
Require (`require 'xp'`) the gem to use in Ruby scripts. Following one liner can download all Dribbble shots in its home page:
|
22
26
|
|
23
27
|
``` ruby
|
24
|
-
'https://dribbble.com/'.css('.dribbble-link img').xpath('//img/@src').map
|
28
|
+
'https://dribbble.com/'.css('.dribbble-link img').xpath('//img/@src').map(&:text).map(&:download)
|
25
29
|
```
|
26
30
|
|
27
31
|
### API
|
@@ -33,6 +37,6 @@ Method | Return type
|
|
33
37
|
`to_nokogiri` | `Nokogiri::XML::Document` | Converts a url or a page source to Nokogiri object
|
34
38
|
`css(selector)` | `String` | Filters a url or html string based on the selector
|
35
39
|
`xpath(selector)` | `Strng` | Filters a url or html string based on the selector
|
36
|
-
`download(location: 'downloads', name: nil)` | `String` | Downloads the url in the string
|
37
|
-
`page_source(user_agent_alias: :mac_firefox, user_agent: nil)` | `String` | Gets the page source of a url
|
38
|
-
`url?` | `Boolean` | Checks whether current string is a url
|
40
|
+
`download(location: 'downloads', name: nil)` | `String` | Downloads the url in the string (can be customized via the optional parameters)
|
41
|
+
`page_source(user_agent_alias: :mac_firefox, user_agent: nil)` | `String` | Gets the page source of a url (can be customized via optional parameters)
|
42
|
+
`url?` | `Boolean` | Checks whether current string is a url
|
data/pkg/xp-2.0.0.gem
ADDED
Binary file
|
data/xp.gemspec
CHANGED
@@ -3,11 +3,11 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "xp"
|
6
|
-
s.version = "2.0.
|
6
|
+
s.version = "2.0.1"
|
7
7
|
s.authors = ["Jikku Jose"]
|
8
8
|
s.email = ['jikkujose@gmail.com']
|
9
|
-
s.summary = "
|
10
|
-
s.description = "
|
9
|
+
s.summary = "Ruby gem for intuitive web scraping"
|
10
|
+
s.description = "Ruby gem that adds some methods to String class for intuitive HTML/XML scraping"
|
11
11
|
s.homepage = "http://github.com/JikkuJose/xp"
|
12
12
|
s.license = "MIT"
|
13
13
|
s.files = `git ls-files -z`.split("\x0")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jikku Jose
|
@@ -24,9 +24,8 @@ dependencies:
|
|
24
24
|
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.6'
|
27
|
-
description:
|
28
|
-
|
29
|
-
directly from their urls.
|
27
|
+
description: Ruby gem that adds some methods to String class for intuitive HTML/XML
|
28
|
+
scraping
|
30
29
|
email:
|
31
30
|
- jikkujose@gmail.com
|
32
31
|
executables:
|
@@ -46,6 +45,7 @@ files:
|
|
46
45
|
- pkg/xp-0.0.1.gem
|
47
46
|
- pkg/xp-0.0.2.gem
|
48
47
|
- pkg/xp-1.0.0.gem
|
48
|
+
- pkg/xp-2.0.0.gem
|
49
49
|
- research/attribute_extractor.rb
|
50
50
|
- research/bb_parser.rb
|
51
51
|
- research/interface.rb
|
@@ -79,5 +79,5 @@ rubyforge_project:
|
|
79
79
|
rubygems_version: 2.2.2
|
80
80
|
signing_key:
|
81
81
|
specification_version: 4
|
82
|
-
summary:
|
82
|
+
summary: Ruby gem for intuitive web scraping
|
83
83
|
test_files: []
|