-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_abstracts.py
executable file
·41 lines (35 loc) · 1023 Bytes
/
get_abstracts.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python3
import xmltodict
import requests
from html.parser import HTMLParser
class MLStripper(HTMLParser):
def __init__(self):
self.reset()
self.strict = False
self.convert_charrefs= True
self.fed = []
def handle_data(self, d):
self.fed.append(d)
def get_data(self):
return ''.join(self.fed)
def strip_tags(html):
s = MLStripper()
s.feed(html)
return s.get_data()
url = 'https://www.socallinuxexpo.org/scale/21x/sign.xml?cache='
schedule = requests.get(url).content
doc = xmltodict.parse(schedule)
for talk in doc['nodes']['node']:
if talk['Topic'] != "BoFs":
print('##')
print(talk['Title'])
print(strip_tags(talk['Time']),"-",talk['Room'])
if talk['Speakers'] != "None" and talk['Speakers'] != None:
print(talk['Speakers'])
else:
print("")
if talk['Topic'] != None:
print(talk['Topic'])
else:
print("")
print(strip_tags(talk['Short-abstract'].replace('\n', '')))