66from openstates .scrape import Event
77from utils import LXMLMixin
88
9+ INTERIMS_URL = "http://www.wvlegislature.gov/committees/Interims/interims.cfm"
10+
911
1012class WVEventScraper (Scraper , LXMLMixin ):
1113 verify = False
1214 _tz = pytz .timezone ("US/Eastern" )
1315
14- interims_url = "http://www.wvlegislature.gov/committees/Interims/interims.cfm"
15-
1616 def scrape (self ):
1717 com_urls = [
1818 ("Senate" , "http://www.wvlegislature.gov/committees/senate/main.cfm" ),
1919 ("House" , "http://www.wvlegislature.gov/committees/House/main.cfm" ),
20- ("Interim" , self . interims_url ),
20+ ("Interim" , INTERIMS_URL ),
2121 ]
2222 for chamber , url in com_urls :
2323 yield from self .scrape_committees (chamber , url )
@@ -26,7 +26,7 @@ def scrape(self):
2626 # misses meetings that are only published on the consolidated interim
2727 # committee schedule (e.g. the June 14-16 Canaan Valley meetings).
2828 # Scrape those schedule pages directly so those events are captured.
29- yield from self .scrape_interim_schedules (self . interims_url )
29+ yield from self .scrape_interim_schedules ()
3030
3131 def scrape_committees (self , chamber , url ):
3232 event_objects = set ()
@@ -47,7 +47,7 @@ def scrape_committees(self, chamber, url):
4747 event .dedupe_key = event_name
4848 yield event
4949
50- def scrape_interim_schedules (self , url ):
50+ def scrape_interim_schedules (self ):
5151 """Scrape the consolidated interim committee meeting schedule.
5252
5353 The interims landing page lists each interim meeting block (e.g.
@@ -56,6 +56,7 @@ def scrape_interim_schedules(self, url):
5656 meetings. These meetings are not always reachable via the per-
5757 committee "agendas.cfm" crawl, so scrape the schedule directly.
5858 """
59+ url = INTERIMS_URL
5960 page = self .lxmlize (url )
6061 page .make_links_absolute (url )
6162
@@ -82,7 +83,6 @@ def scrape_interim_schedules(self, url):
8283 yield event
8384
8485 def scrape_interim_schedule_page (self , url ):
85- self .info (f"GET { url } " )
8686 page = self .lxmlize (url )
8787 page .make_links_absolute (url )
8888
@@ -119,15 +119,15 @@ def parse_interim_schedule_row(self, row, day, source_url):
119119 adjourn = cells [1 ].text_content ().strip ()
120120 where = cells [3 ].text_content ().strip ()
121121
122- # The committee cell holds either a linked committee name plus a
123- # separate "- Agenda" link, or plain text for site tours/presentations
124- # (e.g. "Dolly Sods"). It may also carry a status suffix such as
125- # "- CANCELLED" or "- JOINT MEETING".
122+ # Only rows with a committee.cfm link are actual committee hearings;
123+ # unlinked rows are site tours or presentations (e.g. "Dolly Sods",
124+ # "Floor Session"), so skip them. The committee cell holds the linked
125+ # committee name plus a separate "- Agenda" link, and may also carry a
126+ # status suffix such as "- CANCELLED" or "- JOINT MEETING".
126127 com_link = cells [2 ].xpath ('.//a[contains(@href, "committee.cfm")]' )
127- if com_link :
128- com = com_link [0 ].text_content ().strip ()
129- else :
130- com = cells [2 ].text_content ().strip ()
128+ if not com_link :
129+ return
130+ com = com_link [0 ].text_content ().strip ()
131131
132132 raw_com_text = cells [2 ].text_content ()
133133 status = "tentative"
@@ -167,21 +167,15 @@ def parse_interim_schedule_row(self, row, day, source_url):
167167 status = status ,
168168 )
169169 event .add_source (source_url )
170-
171- # Only rows with a committee.cfm link are actual committees; the
172- # remaining rows are site tours or presentations, so don't attach a
173- # (bogus) committee entity to those.
174- if com_link :
175- event .add_committee (com , note = "host" )
176- event .add_source (com_link [0 ].get ("href" ))
170+ event .add_committee (com , note = "host" )
171+ event .add_source (com_link [0 ].get ("href" ))
177172
178173 if agenda_link :
179174 self .scrape_interim_agenda_page (event , agenda_link [0 ])
180175
181176 yield event
182177
183178 def scrape_interim_agenda_page (self , event , url ):
184- self .info (f"GET { url } " )
185179 page = self .lxmlize (url )
186180 page .make_links_absolute (url )
187181
0 commit comments