husc 0.2.0 → 0.2.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/Gemfile.lock +1 -1
- data/README.md +10 -0
- data/lib/husc.rb +10 -0
- data/lib/husc/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7af45196d951b1df90c5d23a9c3d82aca78c26b19174573f145e177232adfcf2
|
4
|
+
data.tar.gz: 97f4ebeda8e93eee056359d317bc67401049d8dc5d83b8f2249c66523b558905
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c18dae28174ca670a243b1b067e1d320ba7938b1f70b86aaafe15d819223d109d6360197dfc2ad8349dee2ba30baefce0db55600f9e67410df032dd37251c77
|
7
|
+
data.tar.gz: d67ccef3d4bb088d7c6910f2dea68d2e5bbeb72cac66ec2e31372e29bfd1a591f7a98c1dfa86ff8f68aa3bb69a38407218e6c3655f772747415067e10d3c0322
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -14,6 +14,16 @@ This project enables site crawling and data extraction with xpath and css select
|
|
14
14
|
|
15
15
|
|
16
16
|
## Usage
|
17
|
+
### Description of Instance Methods
|
18
|
+
name | Description
|
19
|
+
-----------|----------------------------------------------
|
20
|
+
send | Set the value you want to submit to the form.
|
21
|
+
submit | Submit form.
|
22
|
+
css | Get node by css selector.
|
23
|
+
xpath | Get node by xpath.
|
24
|
+
attr | Get node's attribute.
|
25
|
+
inner_text | Get node's inner text.
|
26
|
+
|
17
27
|
### Simple Example
|
18
28
|
```ruby
|
19
29
|
require 'husc'
|
data/lib/husc.rb
CHANGED
@@ -158,6 +158,15 @@ class Husc
|
|
158
158
|
end
|
159
159
|
end
|
160
160
|
|
161
|
+
def inner_html(shaping = true)
|
162
|
+
## -----*----- タグ内のHTMLを取得 -----*----- ##
|
163
|
+
if shaping
|
164
|
+
return shaping_string(@doc.inner_html)
|
165
|
+
else
|
166
|
+
@doc.inner_html
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
161
170
|
def text(shaping = true)
|
162
171
|
## -----*----- タグ内の文字列(その他タグ除去)を取得 -----*----- ##
|
163
172
|
if shaping
|
@@ -183,6 +192,7 @@ class Husc
|
|
183
192
|
|
184
193
|
def update_params(html)
|
185
194
|
## -----*----- パラメータを更新 -----*----- ##
|
195
|
+
@url = @agent.page.uri
|
186
196
|
@html = html
|
187
197
|
@doc = Nokogiri::HTML.parse(@html)
|
188
198
|
table_to_hash
|
data/lib/husc/version.rb
CHANGED