def new_comments(): query = request.args.get('q') api = API.using_request(request) if query: rss_title = 'Hacker News: "%s" comments' % query else: rss_title = 'Hacker News: New Comments' rss = RSS(api.comments(), rss_title, 'https://news.ycombinator.com/newcomments') return rss.response()
def newest(): query = request.args.get('q') api = API.using_request(request) if query: rss_title = 'Hacker News: "%s"' % query else: rss_title = 'Hacker News: Newest' rss = RSS(api.newest(), rss_title, 'https://news.ycombinator.com/newest') return rss.response()
def user_threads(): username = request.args.get('id') api = API.using_request(request) api_response = api.user(username, 'threads') rss_title = 'Hacker News: %s threads RSS feed' % username rss_link = 'https://news.ycombinator.com/threads?id=%s' % username rss = RSS(api_response, rss_title, rss_link) return rss.response()
def user_submitted(): username = request.args.get('id') api = API.using_request(request) api_response = api.user(username, 'submitted') rss_title = 'Hacker News: %s submitted RSS feed' % username rss_link = 'https://news.ycombinator.com/submitted?id=%s' % username rss = RSS(api_response, rss_title, rss_link) return rss.response()
def who_is_hiring(include=None): api = API.using_request(request) if include is None: rss = RSS(api.who_is_hiring('all'), 'whoishiring', 'https://news.ycombinator.com/submitted?id=whoishiring') elif include == 'jobs': rss = RSS(api.who_is_hiring(include), 'whoishiring - Who is hiring?', 'https://news.ycombinator.com/submitted?id=whoishiring') elif include == 'hired': rss = RSS(api.who_is_hiring(include), 'whoishiring - Who wants to be hired?', 'https://news.ycombinator.com/submitted?id=whoishiring') elif include == 'freelance': rss = RSS(api.who_is_hiring(include), 'whoishiring - Freelancer? Seeking freelancer?', 'https://news.ycombinator.com/submitted?id=whoishiring') return rss.response()
def new_comments(): query = request.args.get('q') api = API.using_request(request) if query: del api.params['restrictSearchableAttributes'] rss_title = 'Hacker News: "%s" comments' % query else: rss_title = 'Hacker News: New Comments' rss = RSS(api.comments(), rss_title, 'https://news.ycombinator.com/newcomments') return rss.response()
def story_comments(): story_id = request.args.get('id') api = API.using_request(request) api_response = api.comments(story_id=story_id) if api_response['hits']: story = api_response['hits'][0] rss_title = 'Hacker News: New Comments on "%s"' % story['story_title'] else: rss_title = 'Hacker News: New Comments' rss_link = 'https://news.ycombinator.com/item?id=%s' % story_id rss = RSS(api_response, rss_title, rss_link) return rss.response()
def polls(): api = API.using_request(request) rss = RSS(api.polls(), 'Hacker News: Polls') return rss.response()
def jobs(): api = API.using_request(request) rss = RSS(api.jobs(), 'Hacker News: Jobs', 'https://news.ycombinator.com/jobs') return rss.response()
def ask(): api = API.using_request(request) rss = RSS(api.ask_hn(), 'Hacker News: Ask HN', 'https://news.ycombinator.com/ask') return rss.response()
def show(): api = API.using_request(request) rss = RSS(api.show_hn(), 'Hacker News: Show HN') return rss.response()
def frontpage(): api = API.using_request(request) rss_title = 'Hacker News: Front Page' rss = RSS(api.frontpage(), rss_title, 'https://news.ycombinator.com/') return rss.response()
def show(): api = API.using_request(request) rss = RSS(api.show_hn(), 'Hacker News: Show HN', 'https://news.ycombinator.com/shownew') return rss.response()