Commit 1b1927bb3fd70a87cf9cf54fc33e08b560a64b64

Added support for Twitter Search results.
entry.py
(27 / 20)
  
344344 def parse(self):
345345 MultimediaContent.parse(self)
346346
347 # Get rid of line breaks, because that makes parsing more difficult
348 new_content = ""
349 for line in self.content.splitlines():
350 new_content += line
347 try:
348 # Get rid of line breaks, because that makes parsing more difficult
349 new_content = ""
350 for line in self.content.splitlines():
351 new_content += line
351352
352 # Turn it into an xml object for easy parsing
353 x = minidom.parseString('<div>' + new_content + '</div>')
353 # Turn it into an xml object for easy parsing
354 x = minidom.parseString('<div>' + new_content + '</div>')
354355
355 # Second paragraph is thumbnail (#TODO: not anymore?)
356 self.content = x.childNodes[0].childNodes[1].childNodes[0].toxml()
356 # Second paragraph is thumbnail (#TODO: not anymore?)
357 self.content = x.childNodes[0].childNodes[1].childNodes[0].toxml()
357358
358 # Third paragraph is description (optional)
359 if len(x.childNodes[0].childNodes) >= 3:
360 self.summary = x.childNodes[0].childNodes[2].childNodes[0].toxml()
359 # Third paragraph is description (optional)
360 if len(x.childNodes[0].childNodes) >= 3:
361 self.summary = x.childNodes[0].childNodes[2].childNodes[0].toxml()
362 except IndexError:
363 pass
361364
362365class GitoriousUpdate(Entry):
363366 def parse(self):
426426 return self.summary
427427
428428class TwitterUpdate(MicroBlogEntry):
429 def get_content(self):
430 return self.title
431
432 def parse(self):
433 MicroBlogEntry.parse(self)
434 m = re.search('([^:]+): (.+)', self.content)
435 self.author = m.group(1)
436 self.content = m.group(2)
437 self.summary = m.group(2)
429 def get_content(self):
430 return self.title
431
432 def parse(self):
433 MicroBlogEntry.parse(self)
434 m = re.search('([^:]+): (.+)', self.content)
435 if (m):
436 self.author = m.group(1)
437 self.content = m.group(2)
438 self.summary = m.group(2)
438439
439440class TwitterFavorite(TwitterUpdate):
440441 pass
442
443class TwitterSearchResult(TwitterUpdate):
444 pass
441445
442446class WordPressEntry(BlogEntry):
443447 def parse_other(self):
feed.py
(3 / 0)
  
254254
255255class TwitterFavorites(Favorites):
256256 entryClass = entry.TwitterFavorite
257
258class TwitterSearch(Twitter):
259 entryClass = entry.TwitterSearchResult
257260
258261class WordPress(Blog):
259262 entryClass = entry.WordPressEntry