Skip to content

Commit

Permalink
Merge pull request #4973 from NewAgeAirbender/ar_bills
Browse files Browse the repository at this point in the history
AR: Add Votes Back & Fix Selector
  • Loading branch information
NewAgeAirbender authored Jun 27, 2024
2 parents a014e0b + 86e9726 commit 78e6a64
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions scrapers/ar/bills.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import csv
import urllib
import datetime
import os
import pytz
import os
from openstates.scrape import Scraper, Bill, VoteEvent
from openstates.exceptions import EmptyScrape

Expand Down Expand Up @@ -192,7 +192,7 @@ def scrape_bill_page(self, bill):
odd_year = session_year if session_year % 2 else session_year - 1
measureno = bill.identifier.replace(" ", "")
url = (
"http://www.arkleg.state.ar.us/assembly/%s/%s/"
"https://www.arkleg.state.ar.us/assembly/%s/%s/"
"Pages/BillInformation.aspx?measureno=%s" % (odd_year, self.slug, measureno)
)
page = self.get(url).text
Expand Down Expand Up @@ -329,18 +329,16 @@ def scrape_bill_page(self, bill):
media_type="application/pdf",
)

# TODO: reincorporate below code block for vote processing
# (commented out due to scraper having vote event processing issue)
# for link in page.xpath(
# "//div[@role=\"grid\"]/../..//a[contains(@href, '/Bills/Votes?id=')]"
# ):
# date = link.xpath("normalize-space(string(../../div[2]))")
# date = TIMEZONE.localize(
# datetime.datetime.strptime(date, "%m/%d/%Y %I:%M:%S %p")
# )
#
# motion = link.xpath("string(../../div[3])")
# yield from self.scrape_vote(bill, date, motion, link.attrib["href"])
for link in page.xpath(
"//*[@id='tableDataWrapper']/div/div[4]/a[contains(@href, '/Bills/Votes?id=')]"
):
date = link.xpath("normalize-space(string(../../div[2]))")
date = TIMEZONE.localize(
datetime.datetime.strptime(date, "%m/%d/%Y %I:%M:%S %p")
)

motion = link.xpath("string(../../div[3])")
yield from self.scrape_vote(bill, date, motion, link.attrib["href"])

def scrape_vote(self, bill, date, motion, url):
page = self.get(url).text
Expand Down

0 comments on commit 78e6a64

Please sign in to comment.