house_floor_bills 0.1.2 → 0.1.4
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/.travis.yml +1 -1
- data/house_floor_bills.gemspec +2 -2
- data/lib/house_floor_bills/scraper.rb +22 -8
- data/lib/house_floor_bills/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 94d99cd5e475e372bd9e0245e5cdb667910c91cc
|
|
4
|
+
data.tar.gz: 39e999418718201edb8049fae13c1d089f2715b9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 22476ffc79b1e4660b35526739b53209905c52696d4d09b057859348415a2de251274715ef3fd83bf7227b1d339ef10ef5d90cd1a6f01717f94c93683ad8bb0b
|
|
7
|
+
data.tar.gz: 1c61b16207aff2654686b3fb3f32507c2dcced8cf94ac337060d0ca10f2920bb467b10bb561e93f279c0a74543375c25cb7e2e4ec6e5bf831d251170465dbaef
|
data/.travis.yml
CHANGED
data/house_floor_bills.gemspec
CHANGED
|
@@ -29,9 +29,9 @@ Gem::Specification.new do |spec|
|
|
|
29
29
|
spec.executables = ["house-floor-bills"]
|
|
30
30
|
spec.require_paths = ["lib"]
|
|
31
31
|
|
|
32
|
-
spec.add_development_dependency "bundler", "
|
|
32
|
+
spec.add_development_dependency "bundler", ">= 1.11"
|
|
33
33
|
spec.add_development_dependency "rake", "~> 10.0"
|
|
34
34
|
spec.add_development_dependency "rspec", "~> 3.0"
|
|
35
35
|
spec.add_development_dependency "pry"
|
|
36
|
-
spec.add_dependency "nokogiri", "~> 1.
|
|
36
|
+
spec.add_dependency "nokogiri", "~> 1.0"
|
|
37
37
|
end
|
|
@@ -3,7 +3,7 @@ class HouseFloorBills::Scraper
|
|
|
3
3
|
|
|
4
4
|
def initialize(week = "") # Format of week must be "2017-03-27"
|
|
5
5
|
@schedule = HouseFloorBills::Schedule.new
|
|
6
|
-
@doc_schedule = Nokogiri::HTML(open("
|
|
6
|
+
@doc_schedule = Nokogiri::HTML(open("https://docs.house.gov/floor/Default.aspx?date=#{week}"))
|
|
7
7
|
end
|
|
8
8
|
|
|
9
9
|
def scrape
|
|
@@ -19,6 +19,7 @@ class HouseFloorBills::Scraper
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def scrape_bills
|
|
22
|
+
print "Loading "
|
|
22
23
|
@doc_schedule.search("table.floorItems > tr.floorItem").collect do |floor_item|
|
|
23
24
|
# Instantiate the bill
|
|
24
25
|
b = HouseFloorBills::Bill.new
|
|
@@ -27,6 +28,8 @@ class HouseFloorBills::Scraper
|
|
|
27
28
|
b.name = floor_item.css("td.floorText").text.strip
|
|
28
29
|
b.pdf = floor_item.css("td.files a").attr("href").text
|
|
29
30
|
|
|
31
|
+
print "."
|
|
32
|
+
|
|
30
33
|
# Set URL conditionally, based on type of bill:
|
|
31
34
|
if b.number.split.include? "H.R."
|
|
32
35
|
b.url = "https://www.congress.gov/bill/115th-congress/house-bill/#{b.number.split.last}"
|
|
@@ -34,15 +37,26 @@ class HouseFloorBills::Scraper
|
|
|
34
37
|
b.url = "https://www.congress.gov/bill/115th-congress/house-resolution/#{b.number.split.last}"
|
|
35
38
|
elsif b.number.split.include? "S."
|
|
36
39
|
b.url = "https://www.congress.gov/bill/115th-congress/senate-bill/#{b.number.split.last}"
|
|
40
|
+
else
|
|
41
|
+
b.url = ""
|
|
37
42
|
end
|
|
38
43
|
|
|
39
|
-
|
|
40
|
-
b.
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
b.summary =
|
|
44
|
+
# Handle error if couldn't get bill URL
|
|
45
|
+
if b.url == ""
|
|
46
|
+
# Set all to blank
|
|
47
|
+
b.sponsor = ""
|
|
48
|
+
b.committees = ""
|
|
49
|
+
b.status = ""
|
|
50
|
+
b.summary = ""
|
|
51
|
+
else
|
|
52
|
+
doc_bill ||= Nokogiri::HTML(open(b.url))
|
|
53
|
+
b.sponsor = doc_bill.search("table.standard01 > tr:first-child a").text.strip
|
|
54
|
+
b.committees = doc_bill.search("table.standard01 > tr:nth-child(2) td").text.strip
|
|
55
|
+
b.status = doc_bill.search("ol.bill_progress li.selected > text()").text.strip
|
|
56
|
+
b.summary = doc_bill.search("div#bill-summary > p, div#bill-summary li").to_s.gsub("</p>","\n\n").gsub("</li>","\n\n").gsub(/<\/.+>/,"").gsub(/<.+>/,"")
|
|
57
|
+
if b.summary == ""
|
|
58
|
+
b.summary = doc_bill.search("div#main > p").text
|
|
59
|
+
end
|
|
46
60
|
end
|
|
47
61
|
# Add the bill to the schedule
|
|
48
62
|
@schedule.add_bill(b)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: house_floor_bills
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dalma Boros
|
|
@@ -14,14 +14,14 @@ dependencies:
|
|
|
14
14
|
name: bundler
|
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
|
16
16
|
requirements:
|
|
17
|
-
- - "
|
|
17
|
+
- - ">="
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
19
|
version: '1.11'
|
|
20
20
|
type: :development
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
|
-
- - "
|
|
24
|
+
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '1.11'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
@@ -72,14 +72,14 @@ dependencies:
|
|
|
72
72
|
requirements:
|
|
73
73
|
- - "~>"
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: '1.
|
|
75
|
+
version: '1.0'
|
|
76
76
|
type: :runtime
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
|
80
80
|
- - "~>"
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: '1.
|
|
82
|
+
version: '1.0'
|
|
83
83
|
description: Legislative bills scheduled for debate this week on the United States
|
|
84
84
|
House of Representatives floor.
|
|
85
85
|
email:
|
|
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
133
133
|
version: '0'
|
|
134
134
|
requirements: []
|
|
135
135
|
rubyforge_project:
|
|
136
|
-
rubygems_version: 2.6.
|
|
136
|
+
rubygems_version: 2.6.14
|
|
137
137
|
signing_key:
|
|
138
138
|
specification_version: 4
|
|
139
139
|
summary: Bills to be considered on the house floor.
|