first push
This commit is contained in:
30
zArchive/FaceBook/BillPull.py
Normal file
30
zArchive/FaceBook/BillPull.py
Normal file
@@ -0,0 +1,30 @@
|
||||
for sE in senateEvents[:5]:
|
||||
bills = sE.xpath('.//*/div[@class="mb-1"]/a/text()')
|
||||
bill_link = sE.xpath('.//*/div[@class="mb-1"]/a/@href')
|
||||
bill_items = zip(bills, bill_link)
|
||||
print(bills)
|
||||
for b,i in bill_items:
|
||||
if b.startswith("S.F."):
|
||||
print(b, i, "\n\n")
|
||||
|
||||
|
||||
|
||||
|
||||
import os
|
||||
from twilio.rest import Client
|
||||
|
||||
|
||||
# Find your Account SID and Auth Token at twilio.com/console
|
||||
# and set the environment variables. See http://twil.io/secure
|
||||
account_sid = os.environ['ACb416a0b2ed0a1be44c107b8bc1f683c5']
|
||||
auth_token = os.environ['33cae777f215a003deea6d4a0d5027c2']
|
||||
client = Client(account_sid, auth_token)
|
||||
|
||||
message = client.messages \
|
||||
.create(
|
||||
body="Join Earth's mightiest heroes. Like Kevin Bacon.",
|
||||
from_='+15017122661',
|
||||
to='+15558675310'
|
||||
)
|
||||
|
||||
print(message.sid)
|
||||
63
zArchive/FaceBook/Mortimers.mpls.py
Normal file
63
zArchive/FaceBook/Mortimers.mpls.py
Normal file
@@ -0,0 +1,63 @@
|
||||
import re, os, sys
|
||||
from datetime import datetime
|
||||
|
||||
import django
|
||||
sys.path.append('../')
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'ds_events.settings'
|
||||
django.setup()
|
||||
|
||||
from events.models import Event, Organization
|
||||
|
||||
from pprint import pprint as ppr
|
||||
|
||||
from time import sleep
|
||||
from pprint import pprint as ppr
|
||||
from selenium import webdriver as wd
|
||||
from selenium.webdriver.common.by import By
|
||||
|
||||
from xvfbwrapper import Xvfb
|
||||
from lxml import html
|
||||
import pytz
|
||||
|
||||
tz = pytz.timezone("US/Central")
|
||||
|
||||
DATETIME_FORMAT = '%a, %b %d %Y'
|
||||
calendar_url = "https://www.facebook.com/mortimersmpls/events/"
|
||||
current_year = str(datetime.now().year)
|
||||
|
||||
# Initiate and start the Browser
|
||||
br = wd.Firefox()
|
||||
|
||||
|
||||
|
||||
br.get(calendar_url)
|
||||
sleep(10)
|
||||
br.find_element(By.XPATH, '//*/div[@class="x1i10hfl xjbqb8w x6umtig x1b1mbwd xaqea5y xav7gou x1ypdohk xe8uvvx xdj266r x11i5rnm xat24cr x1mh8g0r xexx8yu x4uap5 x18d9i69 xkhd6sd x16tdsg8 x1hl2dhg xggy1nq x1o1ewxj x3x9cwd x1e5q0jg x13rtm0m x87ps6o x1lku1pv x1a2a7pz x9f619 x3nfvp2 xdt5ytf xl56j7k x1n2onr6 xh8yej3"]').click()
|
||||
print("Input Login Info")
|
||||
sleep(30)
|
||||
|
||||
ps = html.fromstring(br.page_source)
|
||||
|
||||
listings = ps.xpath('.//*/div[@class="x9f619 x1n2onr6 x1ja2u2z x78zum5 x2lah0s x1qughib x6s0dn4 xozqiw3 x1q0g3np x1pi30zi x1swvt13 xsag5q8 xz9dl7a x1n0m28w xp7jhwk x1wsgfga x9otpla"]')
|
||||
|
||||
for l in listings:
|
||||
gT = l.xpath('.//*/span/text()')
|
||||
dateTime = gT[0]
|
||||
show_title = gT[1]
|
||||
link = l.xpath('.//*/a/@href')[0].split("?")[0] + " " + current_year
|
||||
print(show_title, dateTime, link)
|
||||
venue, created = Organization.objects.get_or_create(name="Mortimer's")
|
||||
try:
|
||||
new_event = Event.objects.update_or_create(
|
||||
event_type = 'Mu',
|
||||
show_title = show_title,
|
||||
show_link = link,
|
||||
show_date = datetime.strptime(dateTime.split(" AT")[0].strip(), DATETIME_FORMAT),
|
||||
venue = venue
|
||||
)
|
||||
except Exception as e:
|
||||
print(e, "\n\n++++\n\n")
|
||||
continue
|
||||
|
||||
|
||||
br.close()
|
||||
69
zArchive/FaceBook/Mortimers.py
Normal file
69
zArchive/FaceBook/Mortimers.py
Normal file
@@ -0,0 +1,69 @@
|
||||
import re, os, sys
|
||||
from datetime import datetime
|
||||
|
||||
import django
|
||||
sys.path.append('../')
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'ds_events.settings'
|
||||
django.setup()
|
||||
|
||||
from events.models import Event, Organization
|
||||
|
||||
from pprint import pprint as ppr
|
||||
|
||||
from time import sleep
|
||||
from pprint import pprint as ppr
|
||||
from selenium import webdriver as wd
|
||||
from selenium.common.exceptions import TimeoutException
|
||||
from selenium.webdriver.support.ui import Select
|
||||
from selenium.webdriver.common.by import By
|
||||
|
||||
from xvfbwrapper import Xvfb
|
||||
|
||||
import requests
|
||||
from lxml import html
|
||||
|
||||
import pytz
|
||||
|
||||
tz = pytz.timezone("US/Central")
|
||||
|
||||
DATETIME_FORMAT = '%a, %b %d %Y'
|
||||
# Set initial variables for City, etc
|
||||
calendar_url = "https://www.facebook.com/mortimersmpls/events/"
|
||||
current_year = str(datetime.now().year)
|
||||
|
||||
# Initiate and start the Browser
|
||||
br = wd.Firefox()
|
||||
|
||||
br.get(calendar_url)
|
||||
sleep(10)
|
||||
br.find_element(By.XPATH, '//*/div[@class="x1i10hfl xjbqb8w x6umtig x1b1mbwd xaqea5y xav7gou x1ypdohk xe8uvvx xdj266r x11i5rnm xat24cr x1mh8g0r xexx8yu x4uap5 x18d9i69 xkhd6sd x16tdsg8 x1hl2dhg xggy1nq x1o1ewxj x3x9cwd x1e5q0jg x13rtm0m x87ps6o x1lku1pv x1a2a7pz x9f619 x3nfvp2 xdt5ytf xl56j7k x1n2onr6 xh8yej3"]').click()
|
||||
print("Input Login Info")
|
||||
sleep(30)
|
||||
|
||||
ps = html.fromstring(br.page_source)
|
||||
|
||||
listings = ps.xpath('.//*/div[@class="x9f619 x1n2onr6 x1ja2u2z x78zum5 x2lah0s x1qughib x6s0dn4 xozqiw3 x1q0g3np x1pi30zi x1swvt13 xsag5q8 xz9dl7a x1n0m28w xp7jhwk x1wsgfga x9otpla"]')
|
||||
|
||||
for l in listings:
|
||||
gT = l.xpath('.//*/span/text()')
|
||||
dateTime = gT[0]
|
||||
show_title = gT[1]
|
||||
link = l.xpath('.//*/a/@href')[0].split("?")[0] + " " + current_year
|
||||
print(show_title, dateTime, link)
|
||||
venue, created = Organization.objects.get_or_create(name="Mortimer's")
|
||||
try:
|
||||
new_event = Event.objects.update_or_create(
|
||||
event_type = 'Mu',
|
||||
show_title = show_title,
|
||||
show_link = link,
|
||||
show_date = datetime.strptime(dateTime.split(" AT")[0].strip(), DATETIME_FORMAT),
|
||||
venue = venue
|
||||
)
|
||||
except Exception as e:
|
||||
print(e, "\n\n++++\n\n")
|
||||
continue
|
||||
|
||||
|
||||
br.close()
|
||||
|
||||
|
||||
85
zArchive/FaceBook/pillarforum.mpls.py
Normal file
85
zArchive/FaceBook/pillarforum.mpls.py
Normal file
@@ -0,0 +1,85 @@
|
||||
import os, sys
|
||||
from datetime import datetime
|
||||
from dateutil import relativedelta
|
||||
|
||||
import django
|
||||
sys.path.append('../')
|
||||
os.environ['DJANGO_SETTINGS_MODULE'] = 'ds_events.settings'
|
||||
django.setup()
|
||||
|
||||
from time import sleep
|
||||
from pprint import pprint as ppr
|
||||
from selenium import webdriver as wd
|
||||
from selenium.webdriver.common.by import By
|
||||
|
||||
from xvfbwrapper import Xvfb
|
||||
from lxml import html
|
||||
import pytz
|
||||
|
||||
from events.models import Event as DSEvent, Organization
|
||||
from digitools import getBrowser, createURL, createBasicEvent, getSource
|
||||
|
||||
|
||||
exit()
|
||||
|
||||
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",
|
||||
)
|
||||
|
||||
tz = pytz.timezone("US/Central")
|
||||
|
||||
DATETIME_FORMAT = '%B %d %I:%M%p %Y'
|
||||
DATETIME_FORMAT = '%B %A %d %I:%M-%I:%M%p'
|
||||
|
||||
if len(sys.argv) >= 2:
|
||||
arg1 = sys.argv[1]
|
||||
br = getBrowser(arg1)
|
||||
br.get(venue.website)
|
||||
else:
|
||||
print("No run_env")
|
||||
quit()
|
||||
|
||||
try:
|
||||
br.find_element(By.XPATH, '//*[@class="privy-dismiss-content"]').click()
|
||||
except Exception as e:
|
||||
print(e)
|
||||
pass
|
||||
|
||||
months = br.find_elements(By.XPATH, '//*[@class="sse-display"]')
|
||||
|
||||
for month in months:
|
||||
month_name = month.find_element(By.XPATH, './/*[@class="sse-size-28"]/u').text.capitalize()
|
||||
events = month.find_elements(By.XPATH, './/p')
|
||||
for event in events:
|
||||
e = {}
|
||||
eventTitle = event.text
|
||||
try:
|
||||
e['title'] = " ".join(eventTitle.split("-")[1].split(" ")[1:-2])
|
||||
if 'Music' in eventTitle:
|
||||
e['event_type'] = "Mu"
|
||||
elif 'The Growth Arc' in eventTitle:
|
||||
e['event_type'] = "Ot"
|
||||
e['dateTime'] = " ".join([month_name, date, "7:00pm", current_year])
|
||||
e['dateStamp'] = datetime.strptime(e['dateTime'], DATETIME_FORMAT)
|
||||
e['title'] = "The Growth Arc - Relationship Support Space"
|
||||
e['link'] = venue.website
|
||||
elif 'Event' in eventTitle:
|
||||
e['event_type'] = "Mu"
|
||||
else:
|
||||
e['event_type'] = "Ot"
|
||||
date = eventTitle.split(":")[0].split(" ")[1].replace("th", "").replace("nd", "").replace("rd", "").replace("st", "")
|
||||
time = eventTitle.split("-")[1].split(" ")[-2:][0]
|
||||
e['dateTime'] = " ".join([month_name, date, time, current_year])
|
||||
e['dateStamp'] = datetime.strptime(e['dateTime'], DATETIME_FORMAT)
|
||||
e['link'] = venue.website
|
||||
createBasicEvent(e, venue)
|
||||
except Exception as e:
|
||||
print("error ", eventTitle)
|
||||
print(e)
|
||||
|
||||
sleep(3)
|
||||
# ppr(events)
|
||||
br.close()
|
||||
Reference in New Issue
Block a user