Applied changes to xmlParser

This commit is contained in:
Marcin Armacki 2020-05-07 15:23:42 +02:00
parent 3619d637d1
commit e27c8f38e2

View File

@ -26,10 +26,16 @@ def parseData(file):
out['discussions'] = []
for d in soup.forum.find_all('discussion'):
out['discussions'].append({
'id': d.get('id'),
'title': d.find('name').text,
'posts': [
{'id': p.get('id'), 'author': p.userid.text,
'message': p.message.get_text()} for p in d.find_all('post')]
})
'id': d.get('id'),
'title': d.find('name').text,
'first_post': d.firstpost.text,
'posts': [
{
'id': p.get('id'),
'parent': p.find('parent').text,
'author': p.userid.text,
'message': p.message.get_text()
} for p in d.find_all('post')]
})
return(out)