Giter Site home page Giter Site logo

zmedelis / anon Goto Github PK

View Code? Open in Web Editor NEW

This project forked from edsu/anon

0.0 3.0 0.0 215 KB

tweet about anonymous Wikipedia edits from particular IP address ranges

Home Page: https://twitter.com/congressedits

License: Creative Commons Zero v1.0 Universal

anon's Introduction

anon

Build Status Gitter chat

This little coffee script will watch Wikipedia for edits from a set of named IP ranges and will tweet when it notices one. It was inspired by @parliamentedits and is used to make @congressedits available.

If you are curious, the default IP ranges for the US Congress in the config.json.template file came from GovTrack. You can learn more about the significance of Congressional edits to Wikipedia here and here.

Run

To run anon you will need to:

  1. install Node
  2. npm install -g coffee-script
  3. git clone https://github.com/edsu/anon.git
  4. cd anon
  5. npm install
  6. cp config.json.template config.json
  7. add twitter credentials for your bot to config.json (make sure the Twitter app you create has read/write permission so it can tweet)
  8. add IP ranges/names to config.json
  9. modify status template if desired
  10. ./anon.coffee (you may want to run this in a screen or tmux session, or on a cloud service like Heroku (see below))
  11. have some ☕ and wait

IP Ranges

You will notice in the example config.json.template that you can configure ip address ranges using a netmask:

"143.231.0.0/16"

or with an array of start/end IP addresses:

["143.231.0.0", "143.231.255.255"]

These two are equivalent, but the former is a bit faster, and easier to read. The latter is convenient if your range is difficult to express using a netmask.

If you would like your configuration file to reference the IP addresses in the external file just use the filename. So instead of:

{
  "nick": "anon1234",
  "accounts": [
    {
      "consumer_key": "",
      "consumer_secret": "",
      "access_token": "",
      "access_token_secret": "",
      "template": "{{page}} Wikipedia article edited anonymously from {{name}} {{&url}}",
      "ranges": {
        "Home Network": [
          ["192.168.1.1", "192.168.255.255"]
        ]
      }
    }
  ]
}

you would have:

{
  "nick": "anon1234",
  "accounts": [
    {
      "consumer_key": "",
      "consumer_secret": "",
      "access_token": "",
      "access_token_secret": "",
      "template": "{{page}} Wikipedia article edited anonymously from {{name}} {{&url}}",
      "ranges": "ranges.json"
    }
  ]
}

Debugging

If you would like to test without tweeting you can run anon with the --noop flag, which will cause the tweet to be written to the console but not actually sent to Twitter.

./anon.coffee --noop

If you would like to see all the change activity (URLs for each change) to test that it is actually listening, use the --verbose flag:

./anon.coffee --verbose

Alternate Configuration Files

By default anon will look for a config.json file in your current working directory. If you would like to specify the location of the configuration file, use the --config parameter:

./anon.coffee --config test.config

Running on Heroku

A Procfile is included to facilitate running anon on the Heroku cloud service. Once you've satisfied the Heroku prerequisites and setup Heroku, you can run anon via:

heroku create
git push heroku master
heroku ps:scale worker=1

Read more on running Node.js applications on Heroku.

Develop

There is not much to anon but there is a small test suite, which might come in handy if you want to add functionality.

npm test

Which Wikipedias?

anon uses the wikichanges module to listen to 38 language Wikipedias. wikichanges achieves this by logging in to the Wikimedia IRC server and listening to the recent changes channels for each Wikipedia. So if you plan on running wikichanges be sure your network supports IRC (it can sometimes be blocked).

Here are the Wikipedias that it currently supports:

If you would like to have another one added please add a ticket to the wikichanges issue tracker.

License:

  • CC0 public domain dedication

anon's People

Contributors

borice avatar brianfit avatar cananoni avatar cbeer avatar chrismeller avatar chrisrodrigue avatar dannycork avatar dbs avatar drichert avatar edsu avatar gamefanager avatar iewatch avatar ineffyble avatar jarib avatar komachi avatar konklone avatar mbklein avatar mjgiarlo avatar nickslevine avatar ruebot avatar scronide avatar stefan2904 avatar vnglst avatar wdenton avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.