class JianshuSyncer

Public Instance Methods

_handle_node(node) click to toggle source
# File lib/syncers/jianshu_syncer.rb, line 10
def _handle_node(node)
  case node.name
  when 'div'
    img_node = node.css('img')[-1]
    if img_node
      node = img_node
      # jianshu.com uses a //<url> style, therefore
      # append an 'https' in front of '//' part to
      # make it a valid image url.
      node['src'] = 'https:' + node['data-original-src']
    end
  end

  node.to_html
end
get_article_xpath() click to toggle source
# File lib/syncers/jianshu_syncer.rb, line 6
def get_article_xpath
  '//article'
end