1 | # Description
|
2 | # A hubot script that does the things
|
3 | #
|
4 | # Commands:
|
5 | # hubot hello - <what the respond trigger does>
|
6 | # orly - <what the hear trigger does>
|
7 | module.exports = (robot) ->
|
8 | robot.respond /^(fb_urldebug|fud)? (.*)/i, (msg) ->
|
9 | url = msg.match[2]
|
10 | fb_debug = "https://developers.facebook.com/tools/debug/og/object?q=#{url}"
|
11 |
|
12 | graph = 'https://graph.facebook.com/'
|
13 | postData = "id=#{encodeURIComponent(url)}&scrape=true"
|
14 | robot.http(graph).post(postData) (err, res, body) ->
|
15 | return
|
16 | msg.send "#{fb_debug}"
|
17 |
|
18 | # https://graph.facebook.com/fql?q=SELECT url, normalized_url, share_count, like_count, comment_count, total_count, commentsbox_count, comments_fbid, click_count FROM link_stat WHERE url in('http://www.techbang.com/posts/24263-first-start-tests-next-year-in-the-world-high-speed-pipe-trains-at-speeds-up-to-320-km')
|
19 | # robot.respond /(fb_link_stat|fls)? (.*)/i, (msg) ->
|
20 | # url = msg.match[2]
|
21 | # fb_link_stat_link = "https://graph.facebook.com/fql?q=SELECT url, normalized_url, share_count, like_count, comment_count, total_count, commentsbox_count, comments_fbid, click_count FROM link_stat WHERE url in('#{url}')"
|
22 |
|
23 | # robot.http(fb_link_stat_link).get() (err, res, body) ->
|
24 | # result = JSON.parse(body)
|
25 | # msg.send "#{result}"
|