Skip to content

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

License

Notifications You must be signed in to change notification settings

hemartin/hn-responder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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