Skip to content

hemartin/hn-responder

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 

hn-responder

A Python script that replies to every @newsycombinator tweet with a link to the article's comments page.

screenshot

This script uses the Twitter API and Hacker News API via Firebase. It reads all tweets for the authenticated Twitter account and puts them into a queue. A background thread takes the tweets from the queue. If a tweet is from the @newsycombinator Twitter account, the background thread goes through all top Hacker News articles via the Firebase API and selects the article that matches the title of the tweet. It then sends out a reply tweet with the link to the article's comments page.

Setup

To run the script, use the following steps:

  1. Install the Python modules requests-oauthlib and python-firebase:

     pip install requests-oauthlib
     pip install python-firebase
    
  2. Create a Twitter app on https://apps.twitter.com/app/. Get the tokens and secrets for your Twitter app on the "Keys and Access Tokens" page.́

  3. Create file twitter-secrets.json with following contents (replace with your actual tokens and secrets):

     {
         "access_token": "12345",
         "access_token_secret": "abcdefg",
         "consumer_key": "1q2w3e4",
         "consumer_secret": "ABCDEFG"
     }
    
  4. Execute script hn-responder.py from the command line. Note that it will run forever until killed.

     python hn-responder.py
    

About

A Python script that replies to every @newsycombinator tweet with a link to the article's comments page

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages