hn2json 0.0.7 → 0.0.8
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.
- data/lib/hn2json/entity.rb +3 -0
- data/lib/hn2json/parser.rb +20 -1
- data/lib/hn2json/version.rb +1 -1
- metadata +2 -2
data/lib/hn2json/entity.rb
CHANGED
data/lib/hn2json/parser.rb
CHANGED
@@ -34,7 +34,7 @@ module HN2JSON
|
|
34
34
|
|
35
35
|
return :error unless subtext
|
36
36
|
|
37
|
-
return :
|
37
|
+
return :job if subtext.content.split.length <= 3
|
38
38
|
|
39
39
|
tr = subtext.xpath('..').xpath('..').css('tr')
|
40
40
|
|
@@ -46,6 +46,25 @@ module HN2JSON
|
|
46
46
|
|
47
47
|
end
|
48
48
|
|
49
|
+
def get_attrs_job entity
|
50
|
+
|
51
|
+
title = @doc.css('.title a')[0].content
|
52
|
+
|
53
|
+
subtext = @doc.css('.subtext')[0]
|
54
|
+
|
55
|
+
date_regex = /(.*\s.*\sago)/
|
56
|
+
ago = date_regex.match(subtext.content)[1]
|
57
|
+
date_posted = Chronic.parse(ago).to_s
|
58
|
+
|
59
|
+
fulltext = @doc.css('td')[10].content
|
60
|
+
|
61
|
+
entity.add_attrs do |e|
|
62
|
+
e.title = title
|
63
|
+
e.date_posted = date_posted
|
64
|
+
e.fulltext = fulltext
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
49
68
|
def get_attrs_comment entity
|
50
69
|
|
51
70
|
parent_url = @doc.css('.comhead a')[2]['href']
|
data/lib/hn2json/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hn2json
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|