fix webworm comments
This commit is contained in:
parent
0d6a86ace2
commit
283a2b1545
|
@ -17,10 +17,10 @@ TWO_DAYS = 60*60*24*2
|
||||||
|
|
||||||
def list():
|
def list():
|
||||||
feed = []
|
feed = []
|
||||||
|
feed += [(x, 'hackernews') for x in hackernews.feed()[:10]]
|
||||||
|
feed += [(x, 'tildes') for x in tildes.feed()[:10]]
|
||||||
feed += [(x, 'reddit') for x in reddit.feed()[:15]]
|
feed += [(x, 'reddit') for x in reddit.feed()[:15]]
|
||||||
feed += [(x, 'webworm') for x in webworm.feed()[:15]]
|
feed += [(x, 'webworm') for x in webworm.feed()[:15]]
|
||||||
feed += [(x, 'tildes') for x in tildes.feed()[:10]]
|
|
||||||
feed += [(x, 'hackernews') for x in hackernews.feed()[:10]]
|
|
||||||
return feed
|
return feed
|
||||||
|
|
||||||
def get_article(url):
|
def get_article(url):
|
||||||
|
|
|
@ -66,7 +66,7 @@ def comment(i):
|
||||||
c = {}
|
c = {}
|
||||||
c['date'] = unix(i.get('date'))
|
c['date'] = unix(i.get('date'))
|
||||||
c['author'] = i.get('name', '')
|
c['author'] = i.get('name', '')
|
||||||
c['score'] = o.get('reactions').get('❤')
|
c['score'] = i.get('reactions').get('❤')
|
||||||
c['text'] = clean(i.get('body', '') or '')
|
c['text'] = clean(i.get('body', '') or '')
|
||||||
c['comments'] = [comment(j) for j in i['children']]
|
c['comments'] = [comment(j) for j in i['children']]
|
||||||
c['comments'] = list(filter(bool, c['comments']))
|
c['comments'] = list(filter(bool, c['comments']))
|
||||||
|
@ -100,7 +100,8 @@ def story(ref):
|
||||||
s['title'] = r.get('title', '')
|
s['title'] = r.get('title', '')
|
||||||
s['link'] = r.get('canonical_url', '')
|
s['link'] = r.get('canonical_url', '')
|
||||||
s['url'] = r.get('canonical_url', '')
|
s['url'] = r.get('canonical_url', '')
|
||||||
s['comments'] = [comment(i) for i in api(API_ITEM_COMMENTS, r.get('id'))]
|
comments = api(API_ITEM_COMMENTS, r.get('id'))
|
||||||
|
s['comments'] = [comment(i) for i in comments.get('comments')]
|
||||||
s['comments'] = list(filter(bool, s['comments']))
|
s['comments'] = list(filter(bool, s['comments']))
|
||||||
s['num_comments'] = r.get('comment_count', 0)
|
s['num_comments'] = r.get('comment_count', 0)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user