Created
December 24, 2014 13:02
-
-
Save toshia/245f9857c990c8914ae3 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
| # twitpic | |
| defimageopener('twitpic', %r<^http://twitpic\.com/[a-zA-Z0-9]+>) do |display_url| | |
| connection = HTTPClient.new | |
| page = connection.get_content(display_url) | |
| next nil if page.empty? | |
| doc = Nokogiri::HTML(page) | |
| result = doc.css('img').lazy.find_all{ |dom| | |
| %r<https?://.*?\.cloudfront\.net/photos/(?:large|full)/.*> =~ dom.attribute('src') | |
| }.first | |
| open(result.attribute('src')) | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment