Created
July 27, 2014 12:41
-
-
Save pgmot/5c40c65bd3b8265e2c51 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Description: | |
# taisya | |
# | |
# Dependencies: | |
# "request" | |
# "cheerio" | |
# | |
# Configuration: | |
# None | |
# | |
# Commands: | |
# hubot taisya - taisya | |
# | |
# Author: | |
# programmerMOT | |
request = require 'request' | |
cheerio = require 'cheerio' | |
module.exports = (robot) -> | |
robot.respond /taisya/i, (msg) -> | |
url = "http://shindanmaker.com/311937" | |
username = Math.floor(Math.random()*100000000+1) | |
options = | |
headers: {'content-type' : 'application/x-www-form-urlencoded'} | |
url: url | |
timeout: 2000 | |
body: "u="+username+"&from=" | |
request.post options, (error, response, body) -> | |
$ = cheerio.load body | |
result = $("div.result > div").text().replace(/\n/g, "").replace(/\t/g, "").replace(/出社/g, "退社") | |
msg.send(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment