updated naming conventions
This commit is contained in:
78
Working/venues/mn.mpls.pillarforum.py
Normal file
78
Working/venues/mn.mpls.pillarforum.py
Normal file
@@ -0,0 +1,78 @@
|
||||
import os, sys
|
||||
from datetime import datetime
|
||||
from dateutil import relativedelta
|
||||
|
||||
sys.path.append('/var/www/digisnaxx.ado/scrapers')
|
||||
import dtss
|
||||
dtss.getReady()
|
||||
|
||||
from time import sleep
|
||||
from pprint import pprint as ppr
|
||||
import pytz
|
||||
|
||||
from events.models import Organization, Scraper
|
||||
import events.digitools as digitools
|
||||
|
||||
|
||||
current_year = str(datetime.now().year)
|
||||
|
||||
venue, created = Organization.objects.get_or_create(
|
||||
name="Piller Forum",
|
||||
city="Minneapolis",
|
||||
website="https://www.pilllar.com/pages/events",
|
||||
is_venue = True
|
||||
)
|
||||
|
||||
scraper,item_count_start,virtcal = digitools.getScraper(venue, venue.website, 'msp')
|
||||
|
||||
event_type = "Mu"
|
||||
|
||||
# Time Signatures
|
||||
tz = pytz.timezone("US/Central")
|
||||
DATETIME_FORMAT = '%b. %d %Y %I:%M%p'
|
||||
DATETIME_FORMAT_night = '%b. %d %Y %I:%M %p'
|
||||
DATETIME_FORMAT_2 = '%b. %d %Y %I:%Mam'
|
||||
|
||||
def get_events(ps, event_type):
|
||||
contents = ps.xpath('.//*/div[@class="sse-row sse-clearfix"]')
|
||||
for c in contents:
|
||||
year = datetime.today().year
|
||||
|
||||
try:
|
||||
date = c.xpath('.//h1[@class="sse-size-64"]/text()')[0]
|
||||
month = date.split(".")[0]
|
||||
ppr(date)
|
||||
if month in ['JAN', 'FEB', 'MAR']:
|
||||
year = int(datetime.today().year) + 1
|
||||
event = {}
|
||||
event['scraper'] = scraper
|
||||
event['calendars'] = scraper.calendar
|
||||
event['link'] = venue.website
|
||||
|
||||
event['title'] = c.xpath('.//p/span/b/text()')[0]
|
||||
event['deets'] = c.xpath('.//p/span/text()')[0]
|
||||
event['title'] = event['title'] + ' ' + event['deets']
|
||||
paras = c.xpath('.//p/text()')
|
||||
times = paras[1].split(" ")[1]
|
||||
event['datetime'] = "{0} {1} {2}".format(date, year, times)
|
||||
event['dateStamp'] =datetime.strptime(event['datetime'], DATETIME_FORMAT)
|
||||
ppr(event)
|
||||
digitools.createBasicEvent(event, event_type, venue)
|
||||
except Exception as e:
|
||||
# print(e)
|
||||
pass
|
||||
|
||||
if len(sys.argv) >= 2:
|
||||
arg1 = sys.argv[1]
|
||||
br = digitools.getBrowser(arg1)
|
||||
else:
|
||||
print("No run_env")
|
||||
quit()
|
||||
|
||||
ps = digitools.getSource(br, venue.website)
|
||||
get_events(ps, event_type)
|
||||
sleep(3)
|
||||
|
||||
br.close()
|
||||
|
||||
digitools.updateScraper(scraper, item_count_start)
|
||||
Reference in New Issue
Block a user