[residentadvisor] search by summary
This commit is contained in:
parent
3b9d3770f4
commit
cbc67ee5a6
3 changed files with 7 additions and 3 deletions
|
|
@ -35,7 +35,7 @@ class ResidentadvisorBrowser(LoginBrowser):
|
|||
login = URL('https://www.residentadvisor.net/login', LoginPage)
|
||||
event = URL('/event.aspx\?(?P<id>\d+)', EventPage)
|
||||
list_events = URL('/events.aspx\?ai=(?P<city>\d+)&v=(?P<v>.+)&yr=(?P<year>\d{4})&mn=(?P<month>\d\d?)&dy=(?P<day>\d\d?)', ListPage)
|
||||
search_page = URL('/search.aspx?searchstr=(?P<query>)§ion=events&titles=1', SearchPage)
|
||||
search_page = URL('/search.aspx\?searchstr=(?P<query>.+)§ion=events&titles=1', SearchPage)
|
||||
attends = URL('/Output/addhandler.ashx')
|
||||
|
||||
def do_login(self):
|
||||
|
|
@ -65,7 +65,7 @@ class ResidentadvisorBrowser(LoginBrowser):
|
|||
|
||||
return event
|
||||
|
||||
def search_events_by_title(self, pattern):
|
||||
def search_events_by_summary(self, pattern):
|
||||
self.search_page.go(query = pattern)
|
||||
assert self.search_page.is_here()
|
||||
|
||||
|
|
|
|||
|
|
@ -142,6 +142,9 @@ class ResidentadvisorModule(Module, CapCalendarEvent):
|
|||
|
||||
for event in self.browser.get_events(city = city_id):
|
||||
yield event
|
||||
elif query.summary:
|
||||
for event in self.browser.search_events_by_summary(query.summary):
|
||||
yield event
|
||||
else:
|
||||
for event in self.list_events(query.start_date, query.end_date):
|
||||
yield event
|
||||
|
|
|
|||
|
|
@ -109,4 +109,5 @@ class SearchPage(BasePage):
|
|||
obj_id = Regexp(Link('./a[1]'), r'\?(\d+)')
|
||||
obj_summary = CleanText('./a[1]')
|
||||
obj_start_date = Date(CleanText('./span[1]'))
|
||||
obj_booked_entries = Type(CleanText('.//p[@class="attending"]/span'), type=float)
|
||||
obj_category = CATEGORIES.CONCERT
|
||||
obj_status = STATUS.CONFIRMED
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue