Scrape and calculate line charges of an AT&T family plan
-
Install node.js: https://nodejs.org/en/
-
Install coffescript compiler globally:
npm install -g coffee-script
-
Install phantomjs: http://phantomjs.org/download.html
-
CD into the project directory
-
Install required modules for the server:
npm install
-
Create config.json in the follwing format
{ "user": "your_user_name", "password": "your_password", "passcode": "12345" }
-
Run
phantomjs phatom.js
-
data.json will be output in the follwing format
{ "lines": { "line-1": { "charge-item-1": 12, "charge-item-2": 34, ... }, "line-2": { ... }, ... }, "usages": { "line-1": 1.3, "line-2": 4.3, ... } }
-
Run
coffee server.coffee
-
Go to http://localhost:3500/ for the report
-
GET /
Route for the report, it will render a loading icon if data.json doesn't exist
-
GET /data
Return data.json in raw form
-
POST /data
Route for uploading data.json manually, use data.json as the request body
-
GET /update
Delete data.json in the directory and start the scraping script, redirect to /
- Scraping script doesn't work on EC2 Ubuntu x64