more scrapers
This commit is contained in:
@@ -14,9 +14,8 @@ from events.models import Organization, Scraper
|
||||
import events.digitools as digitools
|
||||
|
||||
count = 0
|
||||
tz = pytz.timezone("US/Central")
|
||||
DATETIME_FORMAT = '%a, %b %d %Y %I%p'
|
||||
DATETIME_FORMAT_2 = '%a, %b %d %Y %I:%M %p SHOW'
|
||||
tz_str = " -0600 UTC"
|
||||
DATETIME_FORMAT = '%a, %b %d %Y %I%p %z %Z'
|
||||
|
||||
venue, created = Organization.objects.get_or_create(
|
||||
name="Icehouse",
|
||||
@@ -38,19 +37,16 @@ def get_events(ps, event_type):
|
||||
event['link'] = venue.website + c.xpath('.//*/a[@class="show-link"]/@href')[0]
|
||||
event['date'] = c.xpath('.//*/h4[@class="day-of-week"]/text()')[0]
|
||||
month = event['date'].split(' ')[1].strip()
|
||||
print("MONTH: ", month)
|
||||
year = int(datetime.today().year)
|
||||
if month in ['Jan', 'Feb', 'Mar']:
|
||||
year = year + 1
|
||||
time = c.xpath('.//p/span/text()')[0][:4].strip()
|
||||
if time[-1:] == 'm':
|
||||
event['dateStamp'] = event['date'] + ' ' + str(year) + ' ' + time
|
||||
event['dateStamp'] =datetime.strptime(event['dateStamp'], DATETIME_FORMAT)
|
||||
event['dateStamp'] =datetime.strptime(event['dateStamp'] + tz_str, DATETIME_FORMAT)
|
||||
digitools.createBasicEvent(event, event_type, venue)
|
||||
else:
|
||||
ppr(event)
|
||||
print("MONTH: ", month)
|
||||
|
||||
print("Failed ?")
|
||||
except Exception as e:
|
||||
print("What?",e,"\n\n+++")
|
||||
|
||||
@@ -65,6 +61,5 @@ ps = digitools.getSource(br, venue.website)
|
||||
br.execute_script("window.scrollTo(0, window.scrollY + 5000)")
|
||||
get_events(ps, "Mu")
|
||||
|
||||
# ppr(events)
|
||||
br.close()
|
||||
digitools.updateScraper(scraper, item_count_start)
|
||||
|
||||
Reference in New Issue
Block a user