@@ -35,8 +35,12 @@ def scrape_upcoming(self):
3535 page = lxml .html .fromstring (page )
3636 page .make_links_absolute (url )
3737
38+ base_url = "https://sg001-harmony.sliq.net"
3839 for link in page .xpath ("//div[@class='divEvent']/a[1]" ):
39- self .scrape_event (link .xpath ("@href" )[0 ])
40+ href = link .xpath ("@href" )[0 ]
41+ match = re .search (r"setLocationUrl\('([^']+)'\)" , href )
42+ if match :
43+ self .scrape_event (base_url + match .group (1 ))
4044
4145 def scrape_cal_month (self , when : datetime .datetime .date ):
4246 date_str = when .strftime ("%Y%m01" )
@@ -141,6 +145,8 @@ def check_for_existing_event(
141145 # versions and media are in the 'dataModel' js variable on the page
142146 def scrape_versions (self , event : Event , html : str ):
143147 matches = re .search (r"Handouts:\s?(.*)," , html )
148+ if not matches :
149+ return
144150 versions = json .loads (matches .group (1 ))
145151 for v in versions :
146152 event .add_document (
@@ -155,6 +161,8 @@ def scrape_media(self, event: Event, html: str):
155161 # these can be played only by certain players, for example:
156162 # https://livepush.io/hlsplayer/index.html
157163 matches = re .search (r"Media:\s?(.*)," , html )
164+ if not matches :
165+ return
158166 media = json .loads (matches .group (1 ))
159167 if "children" in media and media ["children" ] is not None :
160168 for m in media ["children" ]:
0 commit comments