Created
February 8, 2013 18:26
-
-
Save aytch/4740933 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
| on :message, /https?:\/\/twitter\.com\/(?:#!\/)?(\w+)\/status(es)?\/(\d+)/i do |m, message| | |
| url = message.to_s | |
| doc = Nokogiri::HTML(open(url)) | |
| user = doc.at_css("span.username.js-action-profile-name b").text | |
| status = doc.xpath("//div[3]/div/div/div/div/p").text[/\S(.+)/] | |
| message = "Twitter | @#{user}: #{status}" | |
| m.reply message | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment