Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added feeds related to the whoishiring bot #23

Merged
merged 1 commit into from Jan 13, 2018

Conversation

@jaredandrews
Copy link
Contributor

jaredandrews commented Dec 4, 2017

Every month the HN bot whoishiring posts two threads that I am interested in:

Use case
I think the responses to these threads are worthy of their own HNRSS feeds. A job hunter or freelancer with an RSS feedreader can hook it up and search for relevant keywords.

What is in this Pull Request
Right now HNRSS can provide a feed of the threads started by the whoishiring user. It can also provide a feed of responses to those threads. This Pull Request automates the middle step here which is getting the id of the threads started by whoishiring and feeding them to the comments endpoint that already exists. Multiple posts by whoishiring are merged together to create a feed of responses across all posts.

I have added three endpoints:

  • /whoishiring - returns an aggregate feed of all thread responses by whoishiring
  • /whoishiring/jobs - returns an aggregate feed of all thread responses to 'Ask HN: Who is hiring?' by whoishiring
  • /whoishiring/freelance - returns an aggregate feed of all thread responses to 'Ask HN: Freelancer? Seeking freelancer? ' by whoishiring

Please let me know what you think. Thanks!


pseudo_response = {}
pseudo_response[u'hits'] = all_hits
pseudo_response['link_to'] = None

This comment has been minimized.

@jaredandrews

jaredandrews Dec 4, 2017 Author Contributor

This is a little sketchy, open to ideas for a 'cleaner' approach.

if 'Ask HN: Who is hiring?' in item[u'title'] and ('all' in include or 'jobs' in include):
thread_ids.append(item.get('objectID'))
elif 'Ask HN: Freelancer? Seeking freelancer?' in item[u'title'] and ('all' in include or 'freelance' in include):
thread_ids.append(item.get('objectID'))

This comment has been minimized.

@jaredandrews

jaredandrews Dec 4, 2017 Author Contributor

This basically gets all the threads started by whoishiring and filters them.

if 'hits' in api_response:
all_hits.extend(api_response.get('hits'))

all_responses = merge_two_dicts(api_response, all_responses)

This comment has been minimized.

@jaredandrews

jaredandrews Dec 4, 2017 Author Contributor

The threads are merged into a "pseudo response" that can be read by rss.py and turned into an RSS feed.

pseudo_response[u'hits'] = all_hits
pseudo_response['link_to'] = None

return pseudo_response

This comment has been minimized.

@jaredandrews

jaredandrews Dec 4, 2017 Author Contributor

With a clean cache this entire process can take a couple seconds. I'm not sure if this is a problem on your end or not. Speed could be increased by limiting the number of threads from whoishiring which are analyzed.

This comment has been minimized.

@jaredandrews

jaredandrews Dec 4, 2017 Author Contributor

The way GitHub shows comments makes this hard to parse. I am referring to the complete execution of the who_is_hiring method.

@edavis
Copy link
Owner

edavis commented Dec 5, 2017

Wow, this is a really good PR. The code looks clean, the documentation/explanations are top-notch, and this looks like an interesting and useful addition. I definitely see now you were going for something different than what I originally thought... but this looks great.

Give me a few days so I can find some time to dig into this more fully and work on getting it merged into master.

Thanks!

@jaredandrews jaredandrews changed the title Added feeds related to this whoishiring bot Added feeds related to the whoishiring bot Dec 5, 2017
@jaredandrews
Copy link
Contributor Author

jaredandrews commented Dec 5, 2017

@edavis thank you for the kind words! Let me know if you have any questions on the PR or if you want me to change anything.

@jaredandrews
Copy link
Contributor Author

jaredandrews commented Jan 6, 2018

@edavis hope you are having a wonderful 2018. Have you had a chance to check this out? Thanks!

@edavis
Copy link
Owner

edavis commented Jan 10, 2018

@jaredandrews Yikes, I totally dropped the ball here!

I haven't forgotten about this. I planned on merging it in during the work lull between Christmas and New Years but my dumb body decided to get sick during that week instead.

Hopefully I can get to this soon. Worst case should be this weekend but hoping to knock it out in next few days.

Thanks for your patience!

@edavis edavis merged commit 9c23205 into edavis:master Jan 13, 2018
@edavis
Copy link
Owner

edavis commented Jan 13, 2018

Hey @jaredandrews

This is up on hnrss.org now. I ended up making a few tweaks (bf44065 for details), but this wouldn't have happened without your PR. So thanks for taking the time to send me that.

Kick the tires a bit and let me know if this works for you. Here are the URLs:

https://hnrss.org/whoishiring
https://hnrss.org/whoishiring/jobs
https://hnrss.org/whoishiring/freelance
https://hnrss.org/whoishiring/hired

If all looks good, I'll update the docs in a few days announcing it (with credit, of course).

Have a good one!

@jaredandrews
Copy link
Contributor Author

jaredandrews commented Jan 14, 2018

@edavis Thanks man! Everything appears to be working. Will let you know if I notice any issues. Take it easy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.