Skip to content

Instantly share code, notes, and snippets.

@nanonanomachine
Created May 4, 2015 19:47
Show Gist options
  • Save nanonanomachine/3625882fbebedba38556 to your computer and use it in GitHub Desktop.
Save nanonanomachine/3625882fbebedba38556 to your computer and use it in GitHub Desktop.
ピックアップレシピ表示してくれるやつ
cron = require('cron').CronJob
client = require 'cheerio-httpcli'
module.exports = (robot) ->
# テスト用
#job = new cron '*/1 * * * *', () =>
job = new cron '00 07 * * * ', () =>
robot.logger.debug "pickup_recipes fetch start"
client.fetch 'http://cookpad.com/pickup_recipes', (err, $, res) ->
robot.send {room: "recipe"}, $('title').text()
$('.recipe_title').each (idx) ->
robot.send {room: "recipe"}, 'http://cookpad.com' + $(this).attr('href')
job.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment