statement 1.0.15 → 1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/statement/feed.rb +1 -1
- data/lib/statement/scraper.rb +16 -15
- data/lib/statement/version.rb +1 -1
- metadata +4 -4
data/lib/statement/feed.rb
CHANGED
@@ -49,12 +49,12 @@ module Statement
|
|
49
49
|
def self.from_rss(url)
|
50
50
|
doc = open_rss(url)
|
51
51
|
return unless doc
|
52
|
-
return if Mime::Type.new(doc).html?
|
53
52
|
parse_rss(doc, url)
|
54
53
|
end
|
55
54
|
|
56
55
|
def self.parse_rss(doc, url)
|
57
56
|
links = doc.xpath('//item')
|
57
|
+
return if links.empty?
|
58
58
|
results = links.map do |link|
|
59
59
|
abs_link = Utils.absolute_link(url, link.xpath('link').text)
|
60
60
|
abs_link = "http://www.burr.senate.gov/public/"+ link.xpath('link').text if url == 'http://www.burr.senate.gov/public/index.cfm?FuseAction=RSS.Feed'
|
data/lib/statement/scraper.rb
CHANGED
@@ -29,7 +29,7 @@ module Statement
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def self.member_methods
|
32
|
-
[:capuano, :cold_fusion, :conaway, :chabot, :susandavis, :freshman_senators, :klobuchar, :lujan, :billnelson, :lautenberg, :crapo, :coburn, :boxer, :mccain, :vitter, :donnelly, :inhofe, :levin, :reid, :palazzo, :
|
32
|
+
[:capuano, :cold_fusion, :conaway, :chabot, :susandavis, :freshman_senators, :klobuchar, :lujan, :billnelson, :lautenberg, :crapo, :coburn, :boxer, :mccain, :vitter, :donnelly, :inhofe, :levin, :reid, :palazzo, :roe, :document_query, :swalwell, :fischer]
|
33
33
|
end
|
34
34
|
|
35
35
|
def self.committee_methods
|
@@ -38,8 +38,8 @@ module Statement
|
|
38
38
|
|
39
39
|
def self.member_scrapers
|
40
40
|
year = Date.today.year
|
41
|
-
results = [freshman_senators, capuano, cold_fusion(year, 0), conaway, chabot, susandavis, klobuchar, lujan, palazzo(page=1), billnelson(year=year),
|
42
|
-
document_query(page=1), document_query(page=2),
|
41
|
+
results = [freshman_senators, capuano, cold_fusion(year, 0), conaway, chabot, susandavis, klobuchar, lujan, palazzo(page=1), roe(page=1), billnelson(year=year),
|
42
|
+
document_query(page=1), document_query(page=2), swalwell(page=1), donnelly(year=year), crapo, coburn, boxer(start=1), mccain(year=year),
|
43
43
|
vitter(year=year), inhofe(year=year), reid, fischer].flatten
|
44
44
|
results = results.compact
|
45
45
|
Utils.remove_generic_urls!(results)
|
@@ -519,10 +519,22 @@ module Statement
|
|
519
519
|
end
|
520
520
|
results
|
521
521
|
end
|
522
|
+
|
523
|
+
def self.roe(page=1)
|
524
|
+
results = []
|
525
|
+
domain = 'roe.house.gov'
|
526
|
+
url = "http://roe.house.gov/news/documentquery.aspx?DocumentTypeID=1532&Page=#{page}"
|
527
|
+
doc = open_html(url)
|
528
|
+
return if doc.nil?
|
529
|
+
doc.xpath("//div[@class='middlecopy']//li").each do |row|
|
530
|
+
results << { :source => url, :url => "http://roe.house.gov/news/" + row.children[1]['href'], :title => row.children[1].text.strip, :date => Date.parse(row.children[3].text.strip), :domain => domain }
|
531
|
+
end
|
532
|
+
results
|
533
|
+
end
|
522
534
|
|
523
535
|
def self.document_query(page=1)
|
524
536
|
results = []
|
525
|
-
domains = [{"
|
537
|
+
domains = [{"thornberry.house.gov" => 1776}, {"wenstrup.house.gov" => 2491}]
|
526
538
|
domains.each do |domain|
|
527
539
|
doc = open_html("http://"+domain.keys.first+"/news/documentquery.aspx?DocumentTypeID=#{domain.values.first}&Page=#{page}")
|
528
540
|
return if doc.nil?
|
@@ -533,16 +545,5 @@ module Statement
|
|
533
545
|
results.flatten
|
534
546
|
end
|
535
547
|
|
536
|
-
def self.farenthold(year=2013)
|
537
|
-
results = []
|
538
|
-
url = "http://farenthold.house.gov/index.php?flt_m=&flt_y=#{year}&option=com_content&view=article&id=1181&Itemid=100059&layout=default"
|
539
|
-
doc = open_html(url)
|
540
|
-
return if doc.nil?
|
541
|
-
doc.xpath("//div[@id='idGtReportDisplay']//li").each do |row|
|
542
|
-
results << { :source => url, :url => 'http://farenthold.house.gov'+row.children[0]['href'], :title => row.children[0].text.strip, :date => nil, :domain => "farenthold.house.gov"}
|
543
|
-
end
|
544
|
-
results
|
545
|
-
end
|
546
|
-
|
547
548
|
end
|
548
549
|
end
|
data/lib/statement/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: statement
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: '1.1'
|
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: 2013-10-
|
12
|
+
date: 2013-10-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -214,7 +214,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
214
214
|
version: '0'
|
215
215
|
segments:
|
216
216
|
- 0
|
217
|
-
hash:
|
217
|
+
hash: 3854190129938227300
|
218
218
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
219
219
|
none: false
|
220
220
|
requirements:
|
@@ -223,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
223
223
|
version: '0'
|
224
224
|
segments:
|
225
225
|
- 0
|
226
|
-
hash:
|
226
|
+
hash: 3854190129938227300
|
227
227
|
requirements: []
|
228
228
|
rubyforge_project:
|
229
229
|
rubygems_version: 1.8.25
|