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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.markdown +17 -13
  3. data/pkg/xp-2.0.0.gem +0 -0
  4. data/xp.gemspec +3 -3
  5. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 13d029c7387107e69509519cd142db66354fe3b2
4
- data.tar.gz: b505b2cbae8b7cf9fb799159463070d05b88e30f
3
+ metadata.gz: 55c5dd8e1b84dff2af3120f06dfdf8453edda5c1
4
+ data.tar.gz: b993d48f01ff36a8790c6567bf9c31f7bb6881a3
5
5
  SHA512:
6
- metadata.gz: c7f869d837a99d35cedcac7571780157d8ce2f6551756b150ccd771f91e0447bb4de12a2ca0ed971d8e4d648f7d6ddb8bc8e5c8b1a19033954c748ed9da37503
7
- data.tar.gz: c74fbaaf9bffd099dc47aab7624985f5865ed23d38aea89f6b70634f336719f511f5de4c341ecf1d02fa01f102217a7b98a3484c8376a3931920ae9e9213cc6d
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 4 new methods to String class that enables easy scraping of HTML/XML documents.
3
+ Ruby gem that adds some methods to String class for intuitive HTML/XML scraping.
4
4
 
5
5
  ### Installation
6
6
 
7
- $ gem install xp
7
+ ``` bash
8
+ $ gem install xp
9
+ ```
8
10
 
9
11
  ### Usage
10
12
 
11
- $ curl -s 'https://news.ycombinator.com' | xp --text '//td[class="title"]/a'
12
-
13
- OR
13
+ In command line usage, `xp` filters HTML/XML documents provided via STDIN:
14
14
 
15
- $ curl -s 'https://news.ycombinator.com' | xp --text 'td.title > a'
15
+ ``` bash
16
+ $ curl -s 'https://news.ycombinator.com' | xp --text '//td[class="title"]/a'
17
+ ```
16
18
 
17
- The gem can also be used in Ruby scripts, by `requiring` the gem - `require 'xp'`.
19
+ OR
18
20
 
19
- ### Example
21
+ ``` bash
22
+ $ curl -s 'https://news.ycombinator.com' | xp --text 'td.title > a'
23
+ ```
20
24
 
21
- The following one liner can download all Dribbble shots from its home page:
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 { |link| link.text.download }
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; can be customized via the optional parameters.
37
- `page_source(user_agent_alias: :mac_firefox, user_agent: nil)` | `String` | Gets the page source of a url; can be customized via optional parameters.
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.0"
6
+ s.version = "2.0.1"
7
7
  s.authors = ["Jikku Jose"]
8
8
  s.email = ['jikkujose@gmail.com']
9
- s.summary = "Gem that enables String class to help quick & dirty scraping tasks."
10
- s.description = "Provides a monkey patched String class that can download & filter web pages using CSS/XPATH selectors; also has a very intuitive method to download files directly from their urls."
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.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: Provides a monkey patched String class that can download & filter web
28
- pages using CSS/XPATH selectors; also has a very intuitive method to download files
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: Gem that enables String class to help quick & dirty scraping tasks.
82
+ summary: Ruby gem for intuitive web scraping
83
83
  test_files: []