diff --git a/scraper.py b/scraper.py index 12914771cb1cc4d995485dfe3e54153941348dca..d44d9bb6db902b54358b8ba423034e542dd501ce 100644 --- a/scraper.py +++ b/scraper.py @@ -126,27 +126,25 @@ class FTLiveScraper(Scraper): """ BASE_URL = 'https://fencingtimelive.com' - TOURNAMENTS_URL = urljoin(BASE_URL, 'tournaments/search/data?{query}') + TOURNAMENTS_URL = urljoin(BASE_URL, 'tournaments/search/data/advanced?{query}') TOURNAMENT_URL = urljoin(BASE_URL, 'tournaments/eventSchedule/{tournament_id}') FENCERS_URL = urljoin(BASE_URL, 'events/competitors/data/{event_id}') EVENT_URL = urljoin(BASE_URL, 'events/view/{event_id}') START_FORMAT = '%Y-%m-%dT%H:%M:%S.000Z' EVENT_DATETIME_FORMAT = '%A %B %d, %Y %I:%M %p' - DATE_MODE = -2 # Last 30 days - SEARCH_FROM = timedelta(days=21) # Start search x days into future + MAX_AGO = timedelta(days=7) + MAX_AHEAD = timedelta(days=7) - def list_tournaments(self, search=None, date_mode=None, search_date=None): + def list_tournaments(self, search=None, from_date=None, to_date=None): """Get a list of tournaments in FTLive.""" - if not search_date: - search_date = date.today() + self.SEARCH_FROM - if not date_mode: - date_mode = self.DATE_MODE + if not from_date: + from_date = date.today() - self.MAX_AGO + if not to_date: + to_date = date.today() + self.MAX_AHEAD args = { - 'search': search or '', - 'today': search_date, - 'date': date_mode, - 'filter': 'Country', - 'country': 'USA', + 'tname': search or '', + 'from': from_date or '', + 'to': to_date or '' } url = self.TOURNAMENTS_URL.format(query=urlencode(args)) try: