Merge lp:~stefanor/ibid/mlia-453285 into lp:~ibid-core/ibid/old-trunk-pack-0.92

Proposed by Stefano Rivera
Status: Merged
Approved by: Jonathan Hitchcock
Approved revision: 763
Merged at revision: 761
Proposed branch: lp:~stefanor/ibid/mlia-453285
Merge into: lp:~ibid-core/ibid/old-trunk-pack-0.92
Diff against target: 34 lines
1 file modified
ibid/plugins/lookup.py (+10/-5)
To merge this branch: bzr merge lp:~stefanor/ibid/mlia-453285
Reviewer Review Type Date Requested Status
Jonathan Hitchcock Approve
Michael Gorven Approve
Review via email: mp+13492@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Michael Gorven (mgorven) wrote :

 review approve

review: Approve
Revision history for this message
Jonathan Hitchcock (vhata) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ibid/plugins/lookup.py'
2--- ibid/plugins/lookup.py 2009-10-16 16:31:34 +0000
3+++ ibid/plugins/lookup.py 2009-10-16 17:45:20 +0000
4@@ -213,7 +213,13 @@
5 tree = get_html_parse_tree('http://textsfromlastnight.com/%s/' % section.lower())
6 for div in tree.findAll('div', attrs={'class': 'post_wrap'}):
7 id = int(div.get('id').split('_', 1)[1])
8- message = [line.strip() for line in div.div.contents if isinstance(line, unicode)]
9+ message = []
10+ line = ''
11+ for a in div.findAll('div', attrs={'class': 'post_content'})[0].findAll('a'):
12+ if a['href'].startswith('/areacode/'):
13+ line = u'%s: ' % a.contents[0]
14+ else:
15+ message.append(line + a.contents[0])
16 yield id, message
17
18 @match(r'^tfln'
19@@ -280,12 +286,11 @@
20 else:
21 tree = url
22
23- storycol = [div for div in tree.findall('.//div') if div.get(u'id') in (u'leftcol', u'leftcol-wide')][0]
24- stories = [div for div in storycol.findall('div') if div.get(u'class') in (u'stories', u'stories-wide')]
25+ stories = [div for div in tree.findall('.//div') if div.get(u'class') == u's']
26
27 for story in stories:
28- body = story.findtext('div/span/span').strip()
29- id = story.findtext('.//a')
30+ body = story.findtext('div').strip()
31+ id = story.findtext('div/a')
32 if isinstance(id, basestring) and id[1:].isdigit():
33 id = int(id[1:])
34 yield id, body

Subscribers

People subscribed via source and target branches