Commit 5679d9aa authored by Landon DeCoito's avatar Landon DeCoito
Browse files

Merge branch 'Landon' into 'master'

Landon

See merge request apoulter/mason-today-web!8
parents 818b754f bb610e31
Day1: the fwaque we doin?
Day1.1 : Don't stop belivin
Mason Today Web is a shitty version of the Mason Today project. It will be the conglomeration of 2 horrible programmings trying their damnedest to write functioning code.
Please refer to the requirements.txt for information on what packages to install to properly run the program.
We make soup. A lot of it.
This is currently licensed under the "wut" license. Plznosteal
......@@ -2,20 +2,43 @@ print "and we begin"
from bs4 import BeautifulSoup
import requests
#from bs4.diagnose import diagnose
f = requests.get("http://25livepub.collegenet.com/calendars/events_all.xml") #grabs the xml from 25live
#f = open("events.xml", "r") #Opens a local document. events.xml is a shortened version of the larger events doc
class Event:
def __init__(self, entryTag): #where var entryTag is a specific event tag
self.__name = entryTag.find('title').string
self.__description = entryTag.find('content').string
self.__time = "timeplaceholder"
self.__date = "dateplaceholder"
self.__location = "locationplaceholder"
def __str__(self):
return self.__name + ": " + self.__description + "\n\n"
def cleanup(str):
str = str.replace("&", "&")
str = str.replace(" ", " ")
str = str.replace("–", "-")
str = str.replace("&lt;", "<")
str = str.replace("&gt;", ">")
str = str.replace("<br/>", "\n")
return str
xmldoc = requests.get("http://25livepub.collegenet.com/calendars/events_all.xml") #grabs the xml from 25live
#xmldoc = open("events.xml", "r") #Opens a local document. events.xml is a shortened version of the larger events doc
xmldoc = cleanup(xmldoc.text)
print xmldoc
soup = BeautifulSoup(xmldoc, "lxml") #creates soup of the xml
print soup.prettify(), "\n\n"
soup = BeautifulSoup(f.text, "lxml") #creates soup of the xml
entries = soup.find_all('entry') #creates a list of all the entry tags from the xml
print type(entries[0]), "\n" #prints the first entry
print entries[0].prettify(), "\n" #prints the first entry out
print entries[0].find('content').prettify(), "\n" #prints the first content tag in the first entry
#print type(entries[0]), "\n" #prints the first entry
#print entries[0].prettify(), "\n" #prints the first entry out
#print entries[0].find('content').prettify(), "\n" #prints the first content tag in the first entry
titles = []
for item in entries:
titles.append(item.find('title').string)
#this iterates through the entries and puts each event's title into a list
print titles
#for item in entries:
# print item.find('content').string, "\n\n"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment