Skip to content
Browse files

the twitter parser redone

  • Loading branch information...
1 parent 1dec061 commit c791a9d0b80395540a36223ece1da74a9bd60e08 philgo20 committed Feb 21, 2011
Showing with 3 additions and 6 deletions.
  1. +3 −6 liclient/parsers/lixml.py
View
9 liclient/parsers/lixml.py
@@ -295,12 +295,9 @@ def __init__(self, content):
self.results = self.__build_data(self.tree)
def __build_data(self, tree):
- data = {}
- for n in tree.getchildren():
- if not n.getchildren():
- data[re.sub('-', '_', n.tag)] = n.text
- else:
- data[re.sub('-', '_', n.tag)] = n.getchildren()[0].text
+ data = dict(
+ [(re.sub('-','_',key),self.xpath_collection[key](tree)[0].text) for key in self.xpath_collection if len(self.xpath_collection[key](tree)) > 0]
+ )
results = mappers.TwitterAccount(data, tree)
return results

0 comments on commit c791a9d

Please sign in to comment.
Something went wrong with that request. Please try again.