Fix Better HN api content extraction
This commit is contained in:
		| @@ -131,7 +131,7 @@ def bhn_story(ref): | |||||||
|     s['num_comments'] = r.get('comments_count', 0) |     s['num_comments'] = r.get('comments_count', 0) | ||||||
|  |  | ||||||
|     if 'content' in r and r['content']: |     if 'content' in r and r['content']: | ||||||
|         s['text'] = clean(r['text'] or '') |         s['text'] = clean(r['content'] or '') | ||||||
|  |  | ||||||
|     return s |     return s | ||||||
|  |  | ||||||
| @@ -157,4 +157,6 @@ if __name__ == '__main__': | |||||||
|  |  | ||||||
|     #print(story(42899834))   # type "job" |     #print(story(42899834))   # type "job" | ||||||
|     #print(story(42900076))   # Ask HN |     #print(story(42900076))   # Ask HN | ||||||
|     print(story(42899703))   # normal |     #print(story(42898201))   # Show HN | ||||||
|  |     #print(story(42899703))   # normal | ||||||
|  |     print(story(42902678))   # bad title? | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user