Class: PerNodeSyncer
- Inherits:
-
AbstractSyncer
- Object
- AbstractSyncer
- PerNodeSyncer
- Includes:
- NodeAttrModule
- Defined in:
- lib/syncers/per_node_syncer.rb
Direct Known Subclasses
CSDNSyncer, JianshuSyncer, MediumSyncer, WeixinSyncer, ZhihuSyncer
Constant Summary
Constants included from NodeAttrModule
Instance Method Summary collapse
Methods included from NodeAttrModule
Methods inherited from AbstractSyncer
#_fetch_html, #get_article_xpath, #initialize
Constructor Details
This class inherits a constructor from AbstractSyncer
Instance Method Details
#gen_html ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/syncers/per_node_syncer.rb', line 23 def gen_html article_nodes = self.get_article_nodes content = [] article_nodes.each do |node| NodeAttrModule.remove_common_attr(node) content.append self._handle_node(node) end content.join("\n") end |
#get_article_nodes ⇒ Object
17 18 19 20 21 |
# File 'lib/syncers/per_node_syncer.rb', line 17 def get_article_nodes page_html = self._fetch_html article = Nokogiri::HTML(page_html).xpath(self.get_article_xpath) article.children end |