taiwanese_news_parser 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79a3f654d113a687f130e3c3f2f93b17bee188a2
|
4
|
+
data.tar.gz: 0dc2e3788a102d567895c931e6f4be865176c2af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a77e312c03afe9abf724a53a1685d6ddac30a9353d9d9d4414c7a8a93cadc15b597829b6ede0134d936c54eb8216aee4568ee34fbb71c52b6fac1f507c9a7987
|
7
|
+
data.tar.gz: e3695d63bd62162c6909bfbfa646850f1bf1b6ef8f889029e69a09819faa4d4e35723550956f456adaca73c0d886fcbcea629f29896049726131f1b9c792cab1
|
@@ -23,14 +23,13 @@ class TaiwaneseNewsParser::Parser::LibertyTimesNews < TaiwaneseNewsParser::Parse
|
|
23
23
|
@article[:company_name] = parse_company_name
|
24
24
|
@article[:content] = doc.css('#newstext p').text
|
25
25
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
@article[:published_at] = Time.parse("#{time}:00")
|
26
|
+
doc.css('script').each do |script|
|
27
|
+
match = script.content.match(%r{newsTime\s=\s\'(\d+)\';$})
|
28
|
+
if not match.nil?
|
29
|
+
timestamp = match.captures[0].to_i
|
30
|
+
@article[:published_at] = Time.at(timestamp)
|
31
|
+
break
|
32
|
+
end
|
34
33
|
end
|
35
34
|
|
36
35
|
@article[:reporter_name] = parse_reporter_name()
|
@@ -14,7 +14,7 @@ describe TaiwaneseNewsParser::Parser::LibertyTimesNews do
|
|
14
14
|
article[:content].should include('在今年的七合一選舉和來年的立委、總統選舉時,要求候選人承諾促成非核家園。')
|
15
15
|
article[:company_name].should == '自由時報'
|
16
16
|
article[:reporter_name].should == '李欣芳'
|
17
|
-
article[:published_at].should == Time.new(2014,4,30,14,49)
|
17
|
+
article[:published_at].should == Time.new(2014,4,30,14,49,37)
|
18
18
|
end
|
19
19
|
it do
|
20
20
|
url = 'http://news.ltn.com.tw/news/world/breakingnews/997893'
|
@@ -24,7 +24,7 @@ describe TaiwaneseNewsParser::Parser::LibertyTimesNews do
|
|
24
24
|
article[:content].should include('紐約知名的薩克斯百貨公司')
|
25
25
|
article[:company_name].should == '自由時報'
|
26
26
|
article[:reporter_name].should == nil
|
27
|
-
article[:published_at].should == Time.new(2014,4,30,10,57)
|
27
|
+
article[:published_at].should == Time.new(2014,4,30,10,57,57)
|
28
28
|
end
|
29
29
|
|
30
30
|
it do
|
@@ -35,7 +35,7 @@ describe TaiwaneseNewsParser::Parser::LibertyTimesNews do
|
|
35
35
|
article[:content].should include('又傳酒駕釀禍!花蓮縣壽豐鄉一名男子昨天(28日)在友人家喝得爛醉')
|
36
36
|
article[:company_name].should == '自由時報'
|
37
37
|
article[:reporter_name].should == nil
|
38
|
-
article[:published_at].should == Time.new(2013,6,29,17,52)
|
38
|
+
article[:published_at].should == Time.new(2013,6,29,17,52,5)
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: taiwanese_news_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lulalala
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|