Commit 1b1927bb3fd70a87cf9cf54fc33e08b560a64b64
- Diff rendering mode:
- inline
- side by side
entry.py
(27 / 20)
|   | |||
| 344 | 344 | def parse(self): | |
| 345 | 345 | MultimediaContent.parse(self) | |
| 346 | 346 | ||
| 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 | ||
| 351 | 352 | ||
| 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>') | ||
| 354 | 355 | ||
| 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() | ||
| 357 | 358 | ||
| 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 | ||
| 361 | 364 | ||
| 362 | 365 | class GitoriousUpdate(Entry): | |
| 363 | 366 | def parse(self): | |
| … | … | ||
| 426 | 426 | return self.summary | |
| 427 | 427 | ||
| 428 | 428 | class 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) | ||
| 438 | 439 | ||
| 439 | 440 | class TwitterFavorite(TwitterUpdate): | |
| 440 | 441 | pass | |
| 442 | |||
| 443 | class TwitterSearchResult(TwitterUpdate): | ||
| 444 | pass | ||
| 441 | 445 | ||
| 442 | 446 | class WordPressEntry(BlogEntry): | |
| 443 | 447 | def parse_other(self): |
feed.py
(3 / 0)
|   | |||
| 254 | 254 | ||
| 255 | 255 | class TwitterFavorites(Favorites): | |
| 256 | 256 | entryClass = entry.TwitterFavorite | |
| 257 | |||
| 258 | class TwitterSearch(Twitter): | ||
| 259 | entryClass = entry.TwitterSearchResult | ||
| 257 | 260 | ||
| 258 | 261 | class WordPress(Blog): | |
| 259 | 262 | entryClass = entry.WordPressEntry |

