first working version

This commit is contained in:
Enrico Fasoli 2015-04-23 17:38:28 +02:00
parent 4441ab8735
commit 35517b4e3a
4 changed files with 8 additions and 8 deletions

5
.gitignore vendored
View File

@ -1,5 +1,10 @@
node_modules
hubot.lua
.DS_Store*
.hubot_history
circolari/
run.sh
run_telegram.sh
*.pub
.telegram/
telegram.config

View File

@ -5,4 +5,4 @@ set -e
npm install
export PATH="node_modules/.bin:node_modules/hubot/node_modules/.bin:$PATH"
DEBUG=nightmare PYTHON=python2 PORT=9000 BIND_ADDRESS=localhost node_modules/.bin/hubot --name "asjon" "$@"
DEBUG=nightmare PYTHON=python2 BIND_ADDRESS=localhost node_modules/.bin/hubot --name "asjon" "$@"

View File

@ -19,6 +19,7 @@
"hubot-rules": "^0.1.0",
"hubot-scripts": "^2.5.16",
"hubot-shipit": "^0.2.0",
"hubot-tg": "zenitram/hubot-tg",
"hubot-youtube": "^0.1.2",
"moment": "^2.10.2",
"nightmare": "^1.8.0",

View File

@ -11,12 +11,6 @@ downloadAgenda = (day, cb) ->
unless b
cbCalled = yes
cb []
console.log Nightmare
###
.exists('a[href="?d='+day+'"]',dayHasEvents)
.click('a[href="/agenda/"]').wait()
.click('a[href="?d='+day+'"]').wait()
###
n = new Nightmare()
.goto('https://galilei-cr-sito.registroelettronico.com/login/')
.type('#username',process.env.REGISTRO_USERNAME)
@ -32,7 +26,7 @@ downloadAgenda = (day, cb) ->
rowExtractor = ->
if $('td',this).get(1)?
$($('td',this).get(1)).text().trim()
else ""
else "(niente)"
$ = cheerio.load htmlData
tab = $('.result_table tr').map(rowExtractor).get()
tab.splice 0, 2