module Plugin::PhotoSupport
Constants
- GITHUB_IMAGE_PATTERN
- INSTAGRAM_PATTERN
- SUPPORTED_IMAGE_FORMATS
Public Class Methods
d250g2(display_url)
click to toggle source
Twitter cardsのURLを画像のURLに置き換える。 HTMLを頻繁にリクエストしないように、このメソッドを通すことでメモ化している。
Args¶ ↑
- display_url
Return¶ ↑
String 画像URL()
# File core/plugin/photo_support/photo_support.rb, line 31 def d250g2(display_url) r = via_xpath(display_url, "//meta[@name='twitter:image']/@content") return r if r via_xpath(display_url, "//meta[@name='twitter:image:src']/@content") end
via_xpath(display_url, xpath)
click to toggle source
# File core/plugin/photo_support/photo_support.rb, line 16 def via_xpath(display_url, xpath) connection = HTTPClient.new page = connection.get_content(display_url) unless page.empty? doc = Nokogiri::HTML(page) doc.xpath(xpath).first end end
インスタ映え(display_url)
click to toggle source