Skip to content

Commit

Permalink
WY: Events: Scrape back more months (#4723)
Browse files Browse the repository at this point in the history
* WY: Events: Scrape back more months

* WY: Events: PDF url fix.
  • Loading branch information
showerst authored Nov 15, 2023
1 parent d232cda commit 839aeb1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions scrapers/wy/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
class WYEventScraper(Scraper):
_tz = pytz.timezone("America/Denver")
base_url = "https://web.wyoleg.gov/"
document_base_url = "https://wyoleg.gov/"

def scrape(self):
today = datetime.datetime.today()
Expand All @@ -18,7 +19,7 @@ def scrape(self):

# this month and the next 2 months
events = set()
for add in [0, 1, 2]:
for add in [-2, -1, 0, 1, 2]:
test_date = today + relativedelta.relativedelta(months=+add)
month_url = url.format(str(test_date.year), str(test_date.month).zfill(2))
page = self.get(month_url).json()
Expand Down Expand Up @@ -74,7 +75,7 @@ def scrape(self):
for doc in row["meetingDocuments"]:
event.add_document(
doc["title"],
f"{self.base_url}{doc['documentUrl']}",
f"{self.document_base_url}{doc['documentUrl']}",
on_duplicate="ignore",
)

Expand Down Expand Up @@ -115,14 +116,14 @@ def parse_agenda_item(self, event, item):
for doc in item["meetingDocuments"]:
event.add_document(
doc["title"],
f"{self.base_url}{doc['documentUrl']}",
f"{self.document_base_url}{doc['documentUrl']}",
on_duplicate="ignore",
)

for doc in item["budgetMeetingDocuments"]:
event.add_document(
doc["displayTitle"],
f"{self.base_url}{doc['documentUrl']}",
f"{self.document_base_url}{doc['documentUrl']}",
on_duplicate="ignore",
)

Expand Down

0 comments on commit 839aeb1

Please sign in to comment.