I am trying to parse the info in the bottom right table of the following link, the table that says Current schedule submissions
:
dnedesign.us.to/tables/
I was able to parse it down to:
{s:12:"cfdb7_status";s:6:"unread";s:3:"Day";s:6:"Sunday";s:9:"startTime";s:5:"14:30";s:7:"endTime";s:5:"16:30";}
{s:12:"cfdb7_status";s:6:"unread";s:3:"Day";s:6:"Sunday";s:9:"startTime";s:5:"14:30";s:7:"endTime";s:5:"15:30";}
{s:12:"cfdb7_status";s:6:"unread";s:3:"Day";s:6:"Sunday";s:9:"startTime";s:5:"16:30";s:7:"endTime";s:5:"18:30";}
{s:12:"cfdb7_status";s:6:"unread";s:3:"Day";s:6:"Sunday";s:9:"startTime";s:0:"";s:7:"endTime";s:0:"";}
{s:12:"cfdb7_status";s:6:"unread";s:3:"Day";s:6:"Sunday";s:9:"startTime";s:0:"";s:7:"endTime";s:0:"";}
{s:12:"cfdb7_status";s:6:"unread";s:3:"Day";s:6:"Sunday";s:9:"startTime";s:5:"12:30";s:7:"endTime";s:5:"16:30";}
{s:12:"cfdb7_status";s:6:"unread";s:3:"Day";s:6:"Sunday";s:9:"startTime";s:5:"12:30";s:7:"endTime";s:5:"16:30";}
{s:12:"cfdb7_status";s:6:"unread";s:3:"Day";s:6:"Sunday";s:9:"startTime";s:5:"12:30";s:7:"endTime";s:5:"14:30";}
{s:12:"cfdb7_status";s:6:"unread";s:3:"Day";s:7:"Tuesday";s:9:"startTime";s:5:"14:30";s:7:"endTime";s:5:"16:30";}
and here is the code that performs the parsing to get the above:
try:
from urllib.request import urlopen
except ImportError:
from urllib2 import urlopen
from bs4 import BeautifulSoup
url = 'http://dnedesign.us.to/tables/'
page = urlopen(url)
soup = BeautifulSoup(page, "html.parser")
for rows in soup.find_all('tr'):
for td in rows.find_all('td'):
if 'a:' in td.text:
print(td.text[4:])
I am trying to parse it down to the following:
Day:Tuesday Starttime:14:30 Endtime:16:30
Day:Sunday Starttime:12:30 Endtime:14:30
Day:Sunday Starttime:12:30 Endtime:16:30
Day:Sunday Starttime:12:30 Endtime:16:30
....
....
And so on for the rest of the table.
I am using Python 3.6.9
and Httpie 0.9.8
on Linux Mint Cinnamon 19.1
. This is for my graduation project, any help would be appreciated, thanks.
Neil M.